diff --git a/src/plasma/framesvg.cpp b/src/plasma/framesvg.cpp index 5b90e1c7b..881b63b76 100644 --- a/src/plasma/framesvg.cpp +++ b/src/plasma/framesvg.cpp @@ -866,33 +866,20 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame) } // Corners - if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")) { + if (frame->enabledBorders & FrameSvg::TopBorder) { contentTop = frame->topHeight; bottomOffset += frame->topHeight; - - if (q->hasElement(prefix % "topleft") && frame->enabledBorders & FrameSvg::LeftBorder) { - q->paint(&p, QRect(leftOffset, topOffset, frame->leftWidth, frame->topHeight), prefix % "topleft"); - - contentLeft = frame->leftWidth; - } - - if (q->hasElement(prefix % "topright") && frame->enabledBorders & FrameSvg::RightBorder) { - q->paint(&p, QRect(rightOffset, topOffset, frame->rightWidth, frame->topHeight), prefix % "topright"); - } } - if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom")) { - if (q->hasElement(prefix % "bottomleft") && frame->enabledBorders & FrameSvg::LeftBorder) { - q->paint(&p, QRect(leftOffset, bottomOffset, frame->leftWidth, frame->bottomHeight), prefix % "bottomleft"); - - contentLeft = frame->leftWidth; - } - - if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix % "bottomright")) { - q->paint(&p, QRect(rightOffset, bottomOffset, frame->rightWidth, frame->bottomHeight), prefix % "bottomright"); - } + if (frame->enabledBorders & FrameSvg::LeftBorder) { + contentLeft = frame->leftWidth; } + paintCorner(p, frame, FrameSvg::LeftBorder|FrameSvg::TopBorder, QRect(leftOffset, topOffset, frame->leftWidth, frame->topHeight)); + paintCorner(p, frame, FrameSvg::RightBorder|FrameSvg::TopBorder, QRect(rightOffset, topOffset, frame->rightWidth, frame->topHeight)); + paintCorner(p, frame, FrameSvg::LeftBorder|FrameSvg::BottomBorder, QRect(leftOffset, bottomOffset, frame->leftWidth, frame->bottomHeight)); + paintCorner(p, frame, FrameSvg::RightBorder|FrameSvg::BottomBorder, QRect(rightOffset, bottomOffset, frame->rightWidth, frame->bottomHeight)); + // Sides const int leftHeight = q->elementSize(prefix % "left").height(); paintBorder(p, frame, FrameSvg::LeftBorder, QSize(frame->leftWidth, leftHeight), QRect(leftOffset, contentTop, frame->leftWidth, contentHeight)); @@ -922,6 +909,14 @@ void FrameSvgPrivate::paintBorder(QPainter& p, FrameData* frame, const FrameSvg: } } +void FrameSvgPrivate::paintCorner(QPainter& p, FrameData* frame, Plasma::FrameSvg::EnabledBorders border, const QRect& output) const +{ + QString corner = prefix % borderToElementId(border); + if (frame->enabledBorders & border && q->hasElement(corner)) { + q->paint(&p, output, corner); + } +} + QString FrameSvgPrivate::borderToElementId(FrameSvg::EnabledBorders borders) { switch(borders) { diff --git a/src/plasma/private/framesvg_p.h b/src/plasma/private/framesvg_p.h index f6fb147f8..886d420f5 100644 --- a/src/plasma/private/framesvg_p.h +++ b/src/plasma/private/framesvg_p.h @@ -149,6 +149,7 @@ public: void updateAndSignalSizes(); QSizeF frameSize(FrameData *frame) const; void paintBorder(QPainter& p, FrameData* frame, Plasma::FrameSvg::EnabledBorders border, const QSize& originalSize, const QRect& output) const; + void paintCorner(QPainter& p, Plasma::FrameData* frame, Plasma::FrameSvg::EnabledBorders border, const QRect& output) const; static QString borderToElementId(Plasma::FrameSvg::EnabledBorders borders); Types::Location location;