Change how dirty screen, window and viewport areas are tracked for later redrawing

Track dirty viewport areas seperately form general screen redraws.
Maintain a dirty block grid per viewport, with a smaller block size.
Use even smaller block size in viewport map mode.

Use a rectangle array for general screen redraws instead of a block grid.

Add a dirty bit to windows and widgets, to simplify the common case
of repainting a whole window or widget, without catching
neighbouring windows or viewports.
This commit is contained in:
Jonathan G Rennison
2020-02-21 19:45:07 +00:00
parent d740a19e5f
commit 8f442500ea
18 changed files with 626 additions and 182 deletions

View File

@@ -149,6 +149,7 @@ bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
if (vp != nullptr) { // the vp can be null when how == ZOOM_NONE
vp->virtual_left = w->viewport->scrollpos_x;
vp->virtual_top = w->viewport->scrollpos_y;
UpdateViewportSizeZoom(vp);
}
/* Update the windows that have zoom-buttons to perhaps disable their buttons */
w->InvalidateData();
@@ -183,6 +184,7 @@ void FixTitleGameZoom()
vp->zoom = _gui_zoom;
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
UpdateViewportSizeZoom(vp);
}
static const struct NWidgetPart _nested_main_window_widgets[] = {
@@ -613,5 +615,4 @@ void GameSizeChanged()
_cur_resolution.height = _screen.height;
ScreenSizeChanged();
RelocateAllWindows(_screen.width, _screen.height);
MarkWholeScreenDirty();
}