a new hint: hint-compose-over-border
the centr element will be rendered as big as the image, cropped with the alpha mask and the borderssuperimposed over it. slightly slower but it's the only way to have radial gradients in the center element and have them rendered in a correct way svn path=/trunk/KDE/kdelibs/; revision=1123651
This commit is contained in:
parent
dcba3a27a6
commit
aa33e4ade0
27
framesvg.cpp
27
framesvg.cpp
@ -526,17 +526,32 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
|
||||
q->paint(¢erPainter, QRect(QPoint(0, 0), q->elementSize(prefix + "center")), prefix + "center");
|
||||
}
|
||||
|
||||
p.drawTiledPixmap(QRect(frame->leftWidth, frame->topHeight,
|
||||
contentWidth, contentHeight), center);
|
||||
if (frame->composeOverBorder) {
|
||||
p.drawTiledPixmap(QRect(QPoint(0, 0), size.toSize()), center);
|
||||
} else {
|
||||
p.drawTiledPixmap(QRect(frame->leftWidth, frame->topHeight,
|
||||
contentWidth, contentHeight), center);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (contentHeight > 0 && contentWidth > 0) {
|
||||
q->paint(&p, QRect(frame->leftWidth, frame->topHeight,
|
||||
contentWidth, contentHeight),
|
||||
if (frame->composeOverBorder) {
|
||||
q->paint(&p, QRect(QPoint(0, 0), size.toSize()),
|
||||
prefix + "center");
|
||||
} else {
|
||||
q->paint(&p, QRect(frame->leftWidth, frame->topHeight,
|
||||
contentWidth, contentHeight),
|
||||
prefix + "center");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (frame->composeOverBorder) {
|
||||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||
p.drawPixmap(QRect(QPoint(0, 0), size.toSize()), alphaMask());
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix + "left")) {
|
||||
rightOffset += frame->leftWidth;
|
||||
}
|
||||
@ -738,7 +753,11 @@ void FrameSvgPrivate::updateSizes() const
|
||||
frame->bottomMargin = frame->bottomHeight = 0;
|
||||
}
|
||||
|
||||
frame->composeOverBorder = (q->hasElement(prefix + "hint-compose-over-border") &&
|
||||
q->hasElement(prefix + "mask-center"));
|
||||
|
||||
//since it's rectangular, topWidth and bottomWidth must be the same
|
||||
//the ones that don't have a prefix is for retrocompatibility
|
||||
frame->tileCenter = q->hasElement("hint-tile-center");
|
||||
frame->noBorderPadding = q->hasElement("hint-no-border-padding");
|
||||
frame->stretchBorders = q->hasElement("hint-stretch-borders");
|
||||
|
@ -58,7 +58,8 @@ public:
|
||||
bottomMargin(0),
|
||||
noBorderPadding(false),
|
||||
stretchBorders(false),
|
||||
tileCenter(false)
|
||||
tileCenter(false),
|
||||
composeOverBorder(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -88,6 +89,7 @@ public:
|
||||
bool noBorderPadding : 1;
|
||||
bool stretchBorders : 1;
|
||||
bool tileCenter : 1;
|
||||
bool composeOverBorder : 1;
|
||||
};
|
||||
|
||||
class FrameSvgPrivate
|
||||
|
Loading…
x
Reference in New Issue
Block a user