summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-11-09 14:35:55 +0000
committerManolo Gouy <Manolo>2018-11-09 14:35:55 +0000
commit43b511b784e4350562d0639dfd7a078d761ec54d (patch)
treebb7d01608524f019a2dcac596aefb325aae4374a /src
parentb325a6b4b20e250a6907e520a70a9ab2d772adf9 (diff)
Fix macOS 10.14 Mojave support of the FLTK-cairo interface.
After experimenting with a modified cairo_test program that draws both with cairo and with regular FLTK drawing functions to the same window, it seems necessary to control for possible changes to the graphics context made by cairo in Fl_Cocoa_Window_Driver::make_current() rather than in cairo_create_surface(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13119 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm8
1 files changed, 8 insertions, 0 deletions
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
{