mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-24 23:32:06 +00:00
Try to fix garbage appearing when resizing window. Redraw is probably done a little bit too often.
This commit is contained in:
parent
cf75b4d9ba
commit
1f19d619cf
@ -520,9 +520,10 @@ void Console::Reshape(Rect newBounds)
|
|||||||
if(!consolePort)
|
if(!consolePort)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InsetRect(&newBounds, 2,2);
|
|
||||||
|
|
||||||
bounds = newBounds;
|
bounds = newBounds;
|
||||||
|
InsetRect(&bounds, 2,2);
|
||||||
|
|
||||||
short newRows = (bounds.bottom - bounds.top) / cellSizeY;
|
short newRows = (bounds.bottom - bounds.top) / cellSizeY;
|
||||||
short newCols = (bounds.right - bounds.left) / cellSizeX;
|
short newCols = (bounds.right - bounds.left) / cellSizeX;
|
||||||
|
|
||||||
@ -532,7 +533,7 @@ void Console::Reshape(Rect newBounds)
|
|||||||
upshift = cursorY - (newRows - 1);
|
upshift = cursorY - (newRows - 1);
|
||||||
|
|
||||||
InvalidateCursor();
|
InvalidateCursor();
|
||||||
cursorY = newRows - 1;
|
cursorY = std::max(newRows - 1, 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<AttributedChar> newChars(newRows*newCols, AttributedChar(' ', currentAttr));
|
std::vector<AttributedChar> newChars(newRows*newCols, AttributedChar(' ', currentAttr));
|
||||||
@ -543,25 +544,17 @@ void Console::Reshape(Rect newBounds)
|
|||||||
std::copy(src, src + std::min(cols, newCols), dst);
|
std::copy(src, src + std::min(cols, newCols), dst);
|
||||||
}
|
}
|
||||||
chars.swap(newChars);
|
chars.swap(newChars);
|
||||||
/*newChars = std::vector<char>(newRows*newCols, ' ');
|
|
||||||
for(short row = 0; row < newRows && row < rows; row++)
|
|
||||||
{
|
|
||||||
char *src = &chars[row * cols];
|
|
||||||
char *dst = &newChars[row * newCols];
|
|
||||||
std::copy(src, src + std::min(cols, newCols), dst);
|
|
||||||
}
|
|
||||||
onscreen.swap(newChars);*/
|
|
||||||
onscreen = newChars;
|
onscreen = newChars;
|
||||||
|
|
||||||
rows = newRows;
|
rows = newRows;
|
||||||
cols = newCols;
|
cols = newCols;
|
||||||
|
|
||||||
if(upshift)
|
|
||||||
{
|
dirtyRect = Rect { 0, 0, rows, cols };
|
||||||
//dirtyRect = Rect { 0, 0, rows, cols };
|
EraseRect(&newBounds);
|
||||||
//Update();
|
Update();
|
||||||
Draw();
|
Draw(newBounds);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char Console::WaitNextChar()
|
char Console::WaitNextChar()
|
||||||
|
Loading…
Reference in New Issue
Block a user