Move corner painting into a paintCorner function
This commit is contained in:
parent
f62b357b62
commit
ae56796cb9
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user