PIScreen windows optimization, expanded pisd copy dialog
git-svn-id: svn://db.shs.com.ru/pip@90 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -162,14 +162,11 @@ void PIScreen::SystemConsole::resize(int w, int h) {
|
||||
pcells[i].resize(width, Cell(0));
|
||||
}
|
||||
#ifdef WINDOWS
|
||||
PRIVATE->bs.X = width;
|
||||
PRIVATE->bs.Y = height;
|
||||
PRIVATE->sbi.srWindow = PRIVATE->csbi.srWindow;
|
||||
PRIVATE->chars.resize(width * height);
|
||||
#else
|
||||
#endif
|
||||
for (int i = 0; i < pcells.size_s(); ++i)
|
||||
pcells[i].fill(Cell());
|
||||
#endif
|
||||
clear();
|
||||
clearScreen();
|
||||
}
|
||||
@@ -177,16 +174,44 @@ void PIScreen::SystemConsole::resize(int w, int h) {
|
||||
|
||||
void PIScreen::SystemConsole::print() {
|
||||
#ifdef WINDOWS
|
||||
static int cnt = 0;
|
||||
for (int i = 0; i < width; ++i)
|
||||
for (int j = 0; j < height; ++j) {
|
||||
int k = j * width + i;
|
||||
Cell & c(cells[j][i]);
|
||||
//static int cnt = 0;
|
||||
PRIVATE->srect = PRIVATE->sbi.srWindow;
|
||||
int dx0 = -1, dx1 = -1, dy0 = -1, dy1 = -1;
|
||||
for (int j = 0; j < height; ++j) {
|
||||
PIVector<Cell> & ccv(cells[j]);
|
||||
PIVector<Cell> & pcv(pcells[j]);
|
||||
for (int i = 0; i < width; ++i)
|
||||
if (ccv[i] != pcv[i]) {
|
||||
if (dx0 < 0) {
|
||||
dx0 = dx1 = i;
|
||||
dy0 = dy1 = j;
|
||||
} else {
|
||||
dx0 = piMini(dx0, i);
|
||||
dx1 = piMaxi(dx1, i);
|
||||
dy0 = piMini(dy0, j);
|
||||
dy1 = piMaxi(dy1, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dx0 < 0) return;
|
||||
int dw = dx1 - dx0 + 1, dh = dy1 - dy0 + 1;
|
||||
for (int i = 0; i < dw; ++i)
|
||||
for (int j = 0; j < dh; ++j) {
|
||||
int k = j * dw + i;
|
||||
Cell & c(cells[j + dy0][i + dx0]);
|
||||
PRIVATE->chars[k].Char.UnicodeChar = 0;
|
||||
PRIVATE->chars[k].Char.AsciiChar = c.symbol.toAscii();
|
||||
PRIVATE->chars[k].Attributes = attributes(c);
|
||||
}
|
||||
PRIVATE->srect = PRIVATE->sbi.srWindow;
|
||||
//PRIVATE->bc.X = dx0;
|
||||
//PRIVATE->bc.Y = dy0;
|
||||
//piCout << "draw" << dw << dh;
|
||||
PRIVATE->bs.X = dw;
|
||||
PRIVATE->bs.Y = dh;
|
||||
PRIVATE->srect.Left += dx0;
|
||||
PRIVATE->srect.Top += dy0;
|
||||
PRIVATE->srect.Right -= width - dx1 - 1;
|
||||
PRIVATE->srect.Bottom -= height - dy1 - 1;
|
||||
WriteConsoleOutput(PRIVATE->hOut, PRIVATE->chars.data(), PRIVATE->bs, PRIVATE->bc, &PRIVATE->srect);
|
||||
#else
|
||||
PIString s;
|
||||
@@ -226,11 +251,10 @@ void PIScreen::SystemConsole::print() {
|
||||
printf("%s", (formatString(cells[j][i]) + cells[j][i].symbol).data());
|
||||
}*/
|
||||
}
|
||||
for (int i = 0; i < height; ++i)
|
||||
pcells[i] = cells[i];
|
||||
printf("\e[0m");
|
||||
fflush(0);
|
||||
#endif
|
||||
pcells = cells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user