diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-13 19:43:12 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-15 09:28:30 (GMT) |
commit | a72c30020bdadbe0d82e583e17acd25715604f7b (patch) | |
tree | ce82e9ace289d9cb22a09d847497b01222ad1a1c /src/gui/styles/qmacstyle_mac.mm | |
parent | e9ded3b600256686e4a735e365988f317a51db03 (diff) | |
download | Qt-a72c30020bdadbe0d82e583e17acd25715604f7b.zip Qt-a72c30020bdadbe0d82e583e17acd25715604f7b.tar.gz Qt-a72c30020bdadbe0d82e583e17acd25715604f7b.tar.bz2 |
Bad drawing of styled viewports within QAbstractScrollArea
This patch includes lots of refactoring, but the real problem was that
in QWidgetPrivate::paintBackground we call drawPrimitive(PE_Widget) with
a potentialy translated painter, but the opt.rect is not translated.
When having a scroll area the calling function used to translated the
painter and then pass the offset around to rectify. but drawPrimitive
cannot rectify it.
The solution is not to translate the painter but use other way to
rectify the brush
Task-number: 257517
Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index c08009b..5d75392 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1871,24 +1871,23 @@ QPixmap QMacStylePrivate::generateBackgroundPattern() const Fills the given \a rect with the pattern stored in \a brush. As an optimization, HIThemeSetFill us used directly if we are filling with the standard background. */ -void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush) +void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush) { QPoint dummy; const QPaintDevice *target = painter->device(); const QPaintDevice *redirected = QPainter::redirected(target, &dummy); const bool usePainter = redirected && redirected != target; - const QRegion translated = rgn.translated(offset); if (!usePainter && qt_mac_backgroundPattern && qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) { - painter->setClipRegion(translated); + painter->setClipRegion(rgn); CGContextRef cg = qt_mac_cg_context(target); CGContextSaveGState(cg); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted); - const QVector<QRect> &rects = translated.rects(); + const QVector<QRect> &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) { const QRect rect(rects.at(i)); // Anchor the pattern to the top so it stays put when the window is resized. @@ -1899,8 +1898,8 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint CGContextRestoreGState(cg); } else { - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); + const QRect rect(rgn.boundingRect()); + painter->setClipRegion(rgn); painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); } } |