kwineffects: Rename WindowPrePaintData::clip to opaque

"opaque" is more readable than "clip" and it precisely communicates
what that region actually is.
This commit is contained in:
Vlad Zahorodnii 2022-02-23 10:28:32 +02:00
parent 842e46f86f
commit 6ea8463ce6
5 changed files with 19 additions and 19 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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()

View file

@ -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.

View file

@ -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<const AbstractClient *>(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,
});
}