FrameSvg: l & r borders or t & b don't need to have same height resp. width

Summary:
The specification for FrameSvg does not require that all borders exist
or that left & right and top & bottom borders have samples with the same
size in the scalable dimension.
The old assumption in the code broke e.g. themes which had special
variants per screen side for the panel-background and left out elements
for the border side which would not be rendered anyway, but only set a
margin-hint. So e.g. for a panel on the east screen edge, without the
left border element set, leftHeight would be 0 and as result also the
right border not be painted due to an empty size.

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D21106
This commit is contained in:
Friedrich W. H. Kossebau 2019-05-09 22:14:50 +02:00
parent ff8ac120cb
commit fca08ef241

View File

@ -555,11 +555,13 @@ void FrameSvgPrivate::generateFrameBackground(const QSharedPointer<FrameData> &f
// Sides
const int leftHeight = q->elementSize(frame->prefix % QLatin1String("left")).height();
paintBorder(p, frame, FrameSvg::LeftBorder, QSize(frame->leftWidth, leftHeight) * q->devicePixelRatio(), contentRect);
paintBorder(p, frame, FrameSvg::RightBorder, QSize(frame->rightWidth, leftHeight) * q->devicePixelRatio(), contentRect);
const int rightHeight = q->elementSize(frame->prefix % QLatin1String("right")).height();
paintBorder(p, frame, FrameSvg::RightBorder, QSize(frame->rightWidth, rightHeight) * q->devicePixelRatio(), contentRect);
const int topWidth = q->elementSize(frame->prefix % QLatin1String("top")).width();
paintBorder(p, frame, FrameSvg::TopBorder, QSize(topWidth, frame->topHeight) * q->devicePixelRatio(), contentRect);
paintBorder(p, frame, FrameSvg::BottomBorder, QSize(topWidth, frame->bottomHeight) * q->devicePixelRatio(), contentRect);
const int bottomWidth = q->elementSize(frame->prefix % QLatin1String("bottom")).width();
paintBorder(p, frame, FrameSvg::BottomBorder, QSize(bottomWidth, frame->bottomHeight) * q->devicePixelRatio(), contentRect);
p.end();
frame->cachedBackground.setDevicePixelRatio(q->devicePixelRatio());