FrameSvg: Recache maskFrame if enabledBorders has been changed

Summary:
In some cases, when rendering frame svg background, measures & margins
do not correspond to `enabledBorders`. I.e. `bottomHeight` may be equal to 5,
but the bottom border is disabled. This causes visual artifacts like this

{F5878318, layout=center, size=full}

//Pay close attention to the bottom of the Task switcher. It has a transparent strip at the bottom, which shouldn't be there.//

The cause of this problem is that FrameSVGPrivate::alphaMask doesn't take enabledBorders
into account when it's making decision whether it should update maskFrame.

Just for reference, this is "after"

{F5878319, layout=center, size=full}

BUG: 382324
BUG: 390632
BUG: 391659

Test Plan:
* Triggered the Breeze task switcher (with compositing on and off)
* Didn't see any transparent strips

---

* Tried running FrameSvgTest, still passes

Reviewers: #plasma, #frameworks, mart

Reviewed By: #plasma, mart

Subscribers: abetts, mart, aseigo, broulik, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13215
This commit is contained in:
Vlad Zagorodniy 2018-06-02 12:02:42 +03:00
parent a46cd14553
commit dce258bee3

View File

@ -480,9 +480,15 @@ QPixmap FrameSvgPrivate::alphaMask()
updateSizes(maskFrame);
}
const bool shouldUpdate = maskFrame->cachedBackground.isNull()
|| maskFrame->enabledBorders != frame->enabledBorders
|| maskFrame->frameSize != frameSize(frame);
if (!shouldUpdate) {
return maskFrame->cachedBackground;
}
const QString oldKey = cacheId(maskFrame, maskPrefix);
maskFrame->enabledBorders = frame->enabledBorders;
if (maskFrame->cachedBackground.isNull() || maskFrame->frameSize != frameSize(frame)) {
maskFrame->frameSize = frameSize(frame).toSize();
const QString newKey = cacheId(maskFrame, maskPrefix);
if (s_sharedFrames[q->theme()->d].contains(oldKey)) {
@ -492,8 +498,8 @@ QPixmap FrameSvgPrivate::alphaMask()
maskFrame->cachedBackground = QPixmap();
updateSizes(maskFrame);
generateBackground(maskFrame);
}
return maskFrame->cachedBackground;
}