D14783: [scenes/opengl] Correctly draw shadows when corner tiles are missing

David Edmundson <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
davidedmundson added inline comments.

INLINE COMMENTS

> scene_opengl.cpp:2140
> +{
> +    if (leftRect.right() >= rightRect.left()) {
> +        const qreal halfOverlap = qAbs(leftRect.right() - rightRect.left()) / 2;

just > ?

if they're == then we don't need to do anything

also the qAbs is not needed, we know leftRect.right > rightRect.left

> scene_opengl.cpp:2185
>  
>      const int width = std::max({topLeft.width(), left.width(), bottomLeft.width()})
>                      + std::max(top.width(), bottom.width())

may as well

max(top,bottom) + shadowMargins.left + shadowMargins.right

> scene_opengl.cpp:2246
>      // tile won't be rendered.
> -    bool drawTop = true;
> -    if (topLeftRect.right() >= topRightRect.left()) {
> -        const float halfOverlap = qAbs(topLeftRect.right() - topRightRect.left()) / 2;
> -        topLeftRect.setRight(topLeftRect.right() - halfOverlap);
> -        topRightRect.setLeft(topRightRect.left() + halfOverlap);
> -        drawTop = false;
> -    }
> -
> -    bool drawRight = true;
> -    if (topRightRect.bottom() >= bottomRightRect.top()) {
> -        const float halfOverlap = qAbs(topRightRect.bottom() - bottomRightRect.top()) / 2;
> -        topRightRect.setBottom(topRightRect.bottom() - halfOverlap);
> -        bottomRightRect.setTop(bottomRightRect.top() + halfOverlap);
> -        drawRight = false;
> -    }
> -
> -    bool drawBottom = true;
> -    if (bottomLeftRect.right() >= bottomRightRect.left()) {
> -        const float halfOverlap = qAbs(bottomLeftRect.right() - bottomRightRect.left()) / 2;
> -        bottomLeftRect.setRight(bottomLeftRect.right() - halfOverlap);
> -        bottomRightRect.setLeft(bottomRightRect.left() + halfOverlap);
> -        drawBottom = false;
> -    }
> -
> -    bool drawLeft = true;
> -    if (topLeftRect.bottom() >= bottomLeftRect.top()) {
> -        const float halfOverlap = qAbs(topLeftRect.bottom() - bottomLeftRect.top()) / 2;
> -        topLeftRect.setBottom(topLeftRect.bottom() - halfOverlap);
> -        bottomLeftRect.setTop(bottomLeftRect.top() + halfOverlap);
> -        drawLeft = false;
> -    }
> +    distributeHorizontally(topLeftRect, topRightRect);
> +    distributeHorizontally(bottomLeftRect, bottomRightRect);

There's an interesting hypothetical here.

We're treating the null corners as rectangles at a single point, potentially if you had a large enough topleft shadow no topright corner you'll end up distributing it; and now our null image will get a valid rectangle.

> scene_opengl.cpp:2337
>          ty1 = 0.0;
> -        tx2 = 1.0 - topRight.width() / width;
> +        tx2 = tx1 + top.width() / width;
>          ty2 = topRect.height() / height;

Why this change? We've redistributed topRight so using it should be fine?

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D14783

To: zzag, #kwin
Cc: abetts, davidedmundson, kwin, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, lesliezhai, ali-mohamed, hardening, jensreuterberg, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.