diff --git a/framesvg.cpp b/framesvg.cpp index e3938f8bd..bfdca4048 100644 --- a/framesvg.cpp +++ b/framesvg.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,7 @@ public: FrameSvg::EnabledBorders enabledBorders; QPixmap cachedBackground; - QBitmap cachedMask; + QRegion cachedMask; QSizeF frameSize; //measures @@ -337,11 +338,11 @@ QRectF FrameSvg::contentsRect() const } } -QBitmap FrameSvg::mask() const +QRegion FrameSvg::mask() const { FrameData *frame = d->frames[d->prefix]; - if (!frame->cachedMask) { + if (frame->cachedMask.isEmpty()) { // ivan: we are testing whether we have the mask prefixed // elements to use for creating the mask. if (hasElement("mask-" + d->prefix + "center")) { @@ -360,7 +361,7 @@ QBitmap FrameSvg::mask() const if (maskFrame->cachedBackground.isNull()) { d->generateBackground(maskFrame); if (maskFrame->cachedBackground.isNull()) { - return QBitmap(); + return QRegion(); } } @@ -370,10 +371,10 @@ QBitmap FrameSvg::mask() const if (frame->cachedBackground.isNull()) { d->generateBackground(frame); if (frame->cachedBackground.isNull()) { - return QBitmap(); + return QRegion(); } } - frame->cachedMask = QBitmap(frame->cachedBackground.alphaChannel().createMaskFromColor(Qt::black)); + frame->cachedMask = QRegion(QBitmap(frame->cachedBackground.alphaChannel().createMaskFromColor(Qt::black))); } } return frame->cachedMask; @@ -656,7 +657,7 @@ void FrameSvgPrivate::updateSizes() Q_ASSERT(frame); frame->cachedBackground = QPixmap(); - frame->cachedMask = QPixmap(); + frame->cachedMask = QRegion(); if (frame->enabledBorders & FrameSvg::TopBorder) { frame->topHeight = q->elementSize(prefix + "top").height(); diff --git a/framesvg.h b/framesvg.h index 6f465abcf..e90171985 100644 --- a/framesvg.h +++ b/framesvg.h @@ -200,10 +200,10 @@ class PLASMA_EXPORT FrameSvg : public Svg QString prefix(); /** - * Returns a monochrome mask that tightly contains the fully opaque areas of the svg - * @return a monochrome bitmap of opaque areas + * Returns a mask that tightly contains the fully opaque areas of the svg + * @return a region of opaque areas */ - QBitmap mask() const; + QRegion mask() const; /** * Sets whether saving all the rendered prefixes in a cache or not