Codechange: use RAII to automatically restore _cur_dpi after use

This commit is contained in:
Rubidium
2023-01-26 19:21:36 +01:00
committed by rubidium42
parent b7a5d8e296
commit f001e84e5e
18 changed files with 122 additions and 136 deletions

View File

@@ -980,9 +980,8 @@ static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bo
*/
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
{
DrawPixelInfo *old_dpi = _cur_dpi;
DrawPixelInfo bk;
_cur_dpi = &bk;
AutoRestoreBackup dpi_backup(_cur_dpi, &bk);
for (Window *w : Window::IterateFromBack()) {
if (MayBeShown(w) &&
@@ -994,7 +993,6 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
DrawOverlappedWindow(w, std::max(left, w->left), std::max(top, w->top), std::min(right, w->left + w->width), std::min(bottom, w->top + w->height));
}
}
_cur_dpi = old_dpi;
}
/**