FrameSvg: Update mask frame if image path has been changed

Summary:
A FrameSvg can have wrong mask frame if image path has been changed after
the mask frame was generated. Take image path into account when deciding
whether the mask frame should be updated to address that problem.

Depends on D13384

Reviewers: #plasma, #frameworks, mart

Reviewed By: #plasma, mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13496
This commit is contained in:
Vlad Zagorodniy 2018-06-12 19:27:48 +03:00
parent 412a517576
commit 0c8dd9dc2b

View File

@ -469,13 +469,15 @@ QPixmap FrameSvgPrivate::alphaMask()
}
const bool shouldUpdate = maskFrame->enabledBorders != frame->enabledBorders
|| maskFrame->frameSize != frameSize(frame);
|| maskFrame->frameSize != frameSize(frame)
|| maskFrame->imagePath != frame->imagePath;
if (shouldUpdate) {
if (maskFrame->refcount() == 1) {
const QString oldKey = cacheId(maskFrame, maskPrefix);
s_sharedFrames[q->theme()->d].remove(oldKey);
maskFrame->enabledBorders = frame->enabledBorders;
maskFrame->frameSize = frameSize(frame).toSize();
maskFrame->imagePath = frame->imagePath;
const QString newKey = cacheId(maskFrame, maskPrefix);
s_sharedFrames[q->theme()->d].insert(newKey, maskFrame);
maskFrame->cachedBackground = QPixmap();