Avoid superfluous calls to SetDirtyAsBlocks when dragging window
See: #170
This commit is contained in:
@@ -1542,7 +1542,7 @@ void DrawDirtyBlocks()
|
|||||||
RedrawScreenRect(0, 0, _screen.width, _screen.height);
|
RedrawScreenRect(0, 0, _screen.width, _screen.height);
|
||||||
Window *w;
|
Window *w;
|
||||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||||
w->flags &= ~(WF_DIRTY | WF_WIDGETS_DIRTY);
|
w->flags &= ~(WF_DIRTY | WF_WIDGETS_DIRTY | WF_DRAG_DIRTIED);
|
||||||
}
|
}
|
||||||
_whole_screen_dirty = false;
|
_whole_screen_dirty = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -1562,6 +1562,7 @@ void DrawDirtyBlocks()
|
|||||||
|
|
||||||
Window *w;
|
Window *w;
|
||||||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||||
|
w->flags &= ~WF_DRAG_DIRTIED;
|
||||||
if (!MayBeShown(w)) continue;
|
if (!MayBeShown(w)) continue;
|
||||||
|
|
||||||
if (w->viewport != nullptr) w->viewport->is_drawn = false;
|
if (w->viewport != nullptr) w->viewport->is_drawn = false;
|
||||||
|
@@ -2244,7 +2244,10 @@ static EventState HandleWindowDragging()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(w->flags & WF_DRAG_DIRTIED)) {
|
||||||
|
w->flags |= WF_DRAG_DIRTIED;
|
||||||
w->SetDirtyAsBlocks();
|
w->SetDirtyAsBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
int x = _cursor.pos.x + _drag_delta.x;
|
int x = _cursor.pos.x + _drag_delta.x;
|
||||||
int y = _cursor.pos.y + _drag_delta.y;
|
int y = _cursor.pos.y + _drag_delta.y;
|
||||||
|
@@ -254,6 +254,7 @@ enum WindowFlags : uint16 {
|
|||||||
WF_CENTERED = 1 << 10, ///< Window is centered and shall stay centered after ReInit.
|
WF_CENTERED = 1 << 10, ///< Window is centered and shall stay centered after ReInit.
|
||||||
WF_DIRTY = 1 << 11, ///< Whole window is dirty, and requires repainting.
|
WF_DIRTY = 1 << 11, ///< Whole window is dirty, and requires repainting.
|
||||||
WF_WIDGETS_DIRTY = 1 << 12, ///< One or more widgets are dirty, and require repainting.
|
WF_WIDGETS_DIRTY = 1 << 12, ///< One or more widgets are dirty, and require repainting.
|
||||||
|
WF_DRAG_DIRTIED = 1 << 13, ///< The window has already been marked dirty as blocks as part of the current drag operation
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(WindowFlags)
|
DECLARE_ENUM_AS_BIT_SET(WindowFlags)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user