summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-02 03:07:29 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-02 03:28:47 (GMT)
commitb5a2e8bc3e49ed13d44d4273f5e65cda97c55db1 (patch)
treedae66ea79560b260aef183651bb8566a6f40ea7f /src/declarative
parent03ff62841c5dae85fde40982a65980a91c5f3109 (diff)
downloadQt-b5a2e8bc3e49ed13d44d4273f5e65cda97c55db1.zip
Qt-b5a2e8bc3e49ed13d44d4273f5e65cda97c55db1.tar.gz
Qt-b5a2e8bc3e49ed13d44d4273f5e65cda97c55db1.tar.bz2
Ensure semi-transparent rects paint correctly with radius == size/2.
The margins could overlap, which caused overpainting. Ensure the margins are always <= width or height /2. Task-number: QTBUG-14657 Reviewed-by: Yann Bodson
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 59d1a84..99b36a8 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -541,6 +541,12 @@ void QDeclarativeRectangle::drawRect(QPainter &p)
Q_ASSERT(d->rectImage.width() == 2*xOffset + 1);
Q_ASSERT(d->rectImage.height() == 2*yOffset + 1);
+ // check whether we've eliminated the center completely
+ if (2*xOffset > width()+pw)
+ xOffset = (width()+pw)/2;
+ if (2*yOffset > height()+pw)
+ yOffset = (height()+pw)/2;
+
QMargins margins(xOffset, yOffset, xOffset, yOffset);
QTileRules rules(Qt::StretchTile, Qt::StretchTile);
//NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects