From 37a36bcc768fb8ec1cdcca03d4d4cfba6fcc8bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 29 Apr 2010 15:43:00 +0200 Subject: Fix wrong translation and clip for the raster paint-engine on Mac When setting up the CGContextRef for a painter we need to take into account both the redirection-transform and the transform on the painter. Reviewed-by: Gunnar --- src/gui/painting/qpaintengine_mac.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index ac2fcf4..14ba94e 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -118,9 +118,10 @@ QMacCGContext::QMacCGContext(QPainter *p) QRegion clip = p->paintEngine()->systemClip(); QTransform native = p->deviceTransform(); QTransform logical = p->combinedTransform(); + if (p->hasClipping()) { QRegion r = p->clipRegion(); - r.translate(native.dx() - logical.dx(), native.dy() - logical.dy()); + r.translate(native.dx(), native.dy()); if (clip.isEmpty()) clip = r; else @@ -128,10 +129,7 @@ QMacCGContext::QMacCGContext(QPainter *p) } qt_mac_clip_cg(context, clip, 0); - QPainterState *state = static_cast(pe->state); - Q_ASSERT(state); - if (!state->redirectionMatrix.isIdentity()) - CGContextTranslateCTM(context, state->redirectionMatrix.dx(), state->redirectionMatrix.dy()); + CGContextTranslateCTM(context, native.dx(), native.dy()); } } CGContextRetain(context); -- cgit v0.12