From bad25bd5c7827059b947feed042e16c63721ab83 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 9 Jun 2023 17:21:04 +0300 Subject: [PATCH] Revert "scene: Pad damage if scale factor is fractional" This reverts commit 56f6bab0c3d9c7ef0d45efccc5913228c23c2f58. --- src/scene/workspacescene.cpp | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/scene/workspacescene.cpp b/src/scene/workspacescene.cpp index 04bf5df181..52f081ed0e 100644 --- a/src/scene/workspacescene.cpp +++ b/src/scene/workspacescene.cpp @@ -241,29 +241,14 @@ static void resetRepaintsHelper(Item *item, SceneDelegate *delegate) } } -static void accumulateRepaints(Item *item, SceneDelegate *delegate, QRegion *repaints, const bool padDamage) +static void accumulateRepaints(Item *item, SceneDelegate *delegate, QRegion *repaints) { - if (!padDamage) { - *repaints += item->repaints(delegate); - } else { - const auto padding = 1; - - for (const QRect region : item->repaints(delegate)) { - if (region.isEmpty() || region == infiniteRegion()) { - *repaints += region; - continue; - } - - *repaints += QRect{region.x() - padding, region.y() - padding, - region.width() + 2 * padding, region.height() + 2 * padding}; - } - } - + *repaints += item->repaints(delegate); item->resetRepaints(delegate); const auto childItems = item->childItems(); for (Item *childItem : childItems) { - accumulateRepaints(childItem, delegate, repaints, padDamage); + accumulateRepaints(childItem, delegate, repaints); } } @@ -290,17 +275,11 @@ void WorkspaceScene::preparePaintGenericScreen() void WorkspaceScene::preparePaintSimpleScreen() { - // if a fractional scale factor is used, pad the damage to avoid visual - // glitches due to rounding errors (floating point arithmetic) and/or the - // use of GL_LINEAR in the pipeline - const auto scale = painted_screen->scale(); - const bool padDamage = std::trunc(scale) != scale; - for (WindowItem *windowItem : std::as_const(stacking_order)) { Window *window = windowItem->window(); WindowPrePaintData data; data.mask = m_paintContext.mask; - accumulateRepaints(windowItem, painted_delegate, &data.paint, padDamage); + accumulateRepaints(windowItem, painted_delegate, &data.paint); // Clip out the decoration for opaque windows; the decoration is drawn in the second pass. if (window->opacity() == 1.0) { @@ -335,7 +314,7 @@ void WorkspaceScene::preparePaintSimpleScreen() } if (m_dndIcon) { - accumulateRepaints(m_dndIcon.get(), painted_delegate, &m_paintContext.damage, padDamage); + accumulateRepaints(m_dndIcon.get(), painted_delegate, &m_paintContext.damage); } }