From 6ea8463ce68a68af69702362ae96621b2c3a9a78 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 23 Feb 2022 10:28:32 +0200 Subject: [PATCH] kwineffects: Rename WindowPrePaintData::clip to opaque "opaque" is more readable than "clip" and it precisely communicates what that region actually is. --- src/effects/blur/blur.cpp | 18 +++++++++--------- src/effects/wobblywindows/wobblywindows.cpp | 2 +- src/libkwineffects/kwineffects.cpp | 2 +- src/libkwineffects/kwineffects.h | 6 +++--- src/scene.cpp | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/effects/blur/blur.cpp b/src/effects/blur/blur.cpp index 4d7f1985eb..09f3bbaf2e 100644 --- a/src/effects/blur/blur.cpp +++ b/src/effects/blur/blur.cpp @@ -542,22 +542,22 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std:: return; } - const QRegion oldClip = data.clip; - if (data.clip.intersects(m_currentBlur)) { + const QRegion oldOpaque = data.opaque; + if (data.opaque.intersects(m_currentBlur)) { // to blur an area partially we have to shrink the opaque area of a window - QRegion newClip; - for (const QRect &rect : data.clip) { - newClip |= rect.adjusted(m_expandSize, m_expandSize, -m_expandSize, -m_expandSize); + QRegion newOpaque; + for (const QRect &rect : data.opaque) { + newOpaque |= rect.adjusted(m_expandSize, m_expandSize, -m_expandSize, -m_expandSize); } - data.clip = newClip; + data.opaque = newOpaque; // we don't have to blur a region we don't see - m_currentBlur -= newClip; + m_currentBlur -= newOpaque; } // if we have to paint a non-opaque part of this window that intersects with the // currently blurred region we have to redraw the whole region - if ((data.paint - oldClip).intersects(m_currentBlur)) { + if ((data.paint - oldOpaque).intersects(m_currentBlur)) { data.paint |= m_currentBlur; } @@ -579,7 +579,7 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std:: m_currentBlur |= expandedBlur; - m_paintedArea -= data.clip; + m_paintedArea -= data.opaque; m_paintedArea |= data.paint; } diff --git a/src/effects/wobblywindows/wobblywindows.cpp b/src/effects/wobblywindows/wobblywindows.cpp index 759fdbdc02..b904aed668 100644 --- a/src/effects/wobblywindows/wobblywindows.cpp +++ b/src/effects/wobblywindows/wobblywindows.cpp @@ -252,7 +252,7 @@ void WobblyWindowsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da // We have to reset the clip region in order to render clients below // opaque wobbly windows. - data.clip = QRegion(); + data.opaque = QRegion(); while ((presentTime - infoIt->clock).count() > 0) { const auto delta = std::min(presentTime - infoIt->clock, integrationStep); diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index b21ff118b6..5f4922156f 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -37,7 +37,7 @@ void WindowPrePaintData::setTranslucent() { mask |= Effect::PAINT_WINDOW_TRANSLUCENT; mask &= ~Effect::PAINT_WINDOW_OPAQUE; - clip = QRegion(); // cannot clip, will be transparent + opaque = QRegion(); // cannot clip, will be transparent } void WindowPrePaintData::setTransformed() diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 4bb5e2878e..7ab9485a79 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -2754,10 +2754,10 @@ public: */ QRegion paint; /** - * The clip region will be subtracted from paint region of following windows. - * I.e. window will definitely cover it's clip region + * Region indicating the opaque content. It can be used to avoid painting + * windows occluded by the opaque region. */ - QRegion clip; + QRegion opaque; /** * Simple helper that sets data to say the window will be painted as non-opaque. * Takes also care of changing the regions. diff --git a/src/scene.cpp b/src/scene.cpp index 7730ce65c5..a56bd93043 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -346,7 +346,7 @@ void Scene::preparePaintGenericScreen() m_paintContext.phase2Data.append(Phase2Data{ .window = sceneWindow, .region = infiniteRegion(), - .opaque = data.clip, + .opaque = data.opaque, .mask = data.mask, }); } @@ -367,20 +367,20 @@ void Scene::preparePaintSimpleScreen() if (sceneWindow->isOpaque()) { const SurfaceItem *surfaceItem = sceneWindow->surfaceItem(); if (surfaceItem) { - data.clip = surfaceItem->mapToGlobal(surfaceItem->shape()); + data.opaque = surfaceItem->mapToGlobal(surfaceItem->shape()); } } else if (toplevel->hasAlpha() && toplevel->opacity() == 1.0) { const SurfaceItem *surfaceItem = sceneWindow->surfaceItem(); if (surfaceItem) { const QRegion shape = surfaceItem->shape(); const QRegion opaque = surfaceItem->opaque(); - data.clip = surfaceItem->mapToGlobal(shape & opaque); + data.opaque = surfaceItem->mapToGlobal(shape & opaque); } } const AbstractClient *client = dynamic_cast(toplevel); if (client && !client->decorationHasAlpha() && toplevel->opacity() == 1.0) { - data.clip |= sceneWindow->decorationShape().translated(sceneWindow->pos()); + data.opaque |= sceneWindow->decorationShape().translated(sceneWindow->pos()); } sceneWindow->resetPaintingEnabled(); @@ -389,7 +389,7 @@ void Scene::preparePaintSimpleScreen() m_paintContext.phase2Data.append(Phase2Data{ .window = sceneWindow, .region = data.paint, - .opaque = data.clip, + .opaque = data.opaque, .mask = data.mask, }); }