Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created April 29, 2010 13:43
Show Gist options
  • Save torarnv/383616 to your computer and use it in GitHub Desktop.
Save torarnv/383616 to your computer and use it in GitHub Desktop.
commit f5d99c78a8e93e027bd4dabfd6ec42315465f1f9
Author: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Date: Thu Apr 29 15:43:00 2010 +0200
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
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<QPainterState *>(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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment