From 371c9a53dda50a3457baf8792d59c393a09e17c4 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 17 Jul 2014 22:29:54 +0200 Subject: [PATCH] Add composeOverBorder support in FrameSVGItem --- src/declarativeimports/core/framesvgitem.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/declarativeimports/core/framesvgitem.cpp b/src/declarativeimports/core/framesvgitem.cpp index 551b65bae..c82c4ccab 100644 --- a/src/declarativeimports/core/framesvgitem.cpp +++ b/src/declarativeimports/core/framesvgitem.cpp @@ -25,6 +25,7 @@ #include #include +#include #include @@ -77,6 +78,18 @@ public: void updateTexture(const QSize &size, const QString &elementId) { QImage image = m_frameSvg->frameSvg()->image(size, elementId); + + //in compose over border we paint the center over the full size + //then blend in an alpha mask generated from the corners to + //remove the garbage left in the corners + if (m_border == FrameSvg::NoBorder && m_frameSvg->frameData()->composeOverBorder) { + QPixmap pixmap = QPixmap::fromImage(image); + QPainter p(&pixmap); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.drawPixmap(QRect(QPoint(0, 0), size), m_frameSvg->frameSvg()->alphaMask()); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + image = pixmap.toImage(); + } QSGTexture *texture = m_frameSvg->window()->createTextureFromImage(image); setTexture(texture); } @@ -319,7 +332,7 @@ void FrameSvgItem::doUpdate() } bool hasOverlay = !actualPrefix().startsWith(QLatin1String("mask-")) && m_frameSvg->hasElement(actualPrefix() % "overlay"); - m_fastPath = !hasOverlay && !frame->composeOverBorder; + m_fastPath = !hasOverlay; m_textureChanged = true; update(); }