diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2009-10-05 09:46:29 (GMT) |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2009-10-05 09:46:29 (GMT) |
commit | a943e0ae741115fbdd72b7ecfa7702f90ad0890b (patch) | |
tree | 17e7d337a90c4e9577711762b47a71fd97e25c08 /src/declarative/fx | |
parent | 9c80d8284449e8cfc421aa047598020dc4c58772 (diff) | |
download | Qt-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.
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 7 |
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); |