summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2009-10-05 09:46:29 (GMT)
committerChristian Kamm <christian.d.kamm@nokia.com>2009-10-05 09:46:29 (GMT)
commita943e0ae741115fbdd72b7ecfa7702f90ad0890b (patch)
tree17e7d337a90c4e9577711762b47a71fd97e25c08
parent9c80d8284449e8cfc421aa047598020dc4c58772 (diff)
downloadQt-a943e0ae741115fbdd72b7ecfa7702f90ad0890b.zip
Qt-a943e0ae741115fbdd72b7ecfa7702f90ad0890b.tar.gz
Qt-a943e0ae741115fbdd72b7ecfa7702f90ad0890b.tar.bz2
Fix display of rounded Rectangles with border and odd radius.
Due to a rounding issue the sum of the margins was larger than the pixmap size, causing qDrawBorderPixmap to only draw the corners and leaving the sides and center blank.
-rw-r--r--src/declarative/fx/qfxrect.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 0648ac4..ea17452 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -427,14 +427,15 @@ void QFxRect::drawRect(QPainter &p)
int offset = 0;
const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0;
+ const int realpw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
if (d->radius > 0) {
generateRoundedRect();
//### implicit conversion to int
- offset = int(d->radius+1.5+pw);
+ offset = int(d->radius+realpw+1);
} else {
generateBorderedRect();
- offset = pw+1;
+ offset = realpw+1;
}
//basically same code as QFxImage uses to paint sci images
@@ -457,6 +458,8 @@ void QFxRect::drawRect(QPainter &p)
ySide = yOffset * 2;
}
+ Q_ASSERT(d->rectImage.width() >= 2*xOffset + 1);
+ Q_ASSERT(d->rectImage.height() >= 2*yOffset + 1);
QMargins margins(xOffset, yOffset, xOffset, yOffset);
QTileRules rules(Qt::StretchTile, Qt::StretchTile);
qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules);