summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cairo/Fl_Cairo.cxx7
-rw-r--r--src/Fl_cocoa.mm8
2 files changed, 8 insertions, 7 deletions
diff --git a/cairo/Fl_Cairo.cxx b/cairo/Fl_Cairo.cxx
index b6807a2ea..41a4e4b6d 100644
--- a/cairo/Fl_Cairo.cxx
+++ b/cairo/Fl_Cairo.cxx
@@ -103,13 +103,6 @@ static cairo_surface_t * cairo_create_surface(void * gc, int W, int H) {
# elif defined(_WIN32)
return cairo_win32_surface_create((HDC) gc);
# elif defined(__APPLE_QUARTZ__)
- CGAffineTransform mat = CGContextGetCTM((CGContextRef)gc);
- if (mat.d > 0) { // necessary for layer-backed Cairo windows
- CGContextRestoreGState((CGContextRef)gc);
- CGContextRestoreGState((CGContextRef)gc);
- CGContextSaveGState((CGContextRef)gc);
- CGContextSaveGState((CGContextRef)gc);
- }
return cairo_quartz_surface_create_for_cg_context((CGContextRef) gc, W, H);
# else
# error Cairo is not supported under this platform.
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index e039e8070..c6dad6b31 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3421,6 +3421,14 @@ void Fl_Cocoa_Window_Driver::make_current()
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if (views_use_CA) {
gc = ((FLView*)[fl_window contentView])->layer_data.gc;
+# ifdef FLTK_HAVE_CAIRO
+ // make sure the GC starts with an identity transformation matrix as do native Cocoa GC's
+ // because cairo may have changed it
+ CGAffineTransform mat = CGContextGetCTM(gc);
+ if (!CGAffineTransformIsIdentity(mat)) { // 10.4
+ CGContextConcatCTM(gc, CGAffineTransformInvert(mat));
+ }
+# endif
} else
#endif
{