From 2eea5d5856b2da04634ff93887126107117da1b2 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 8 Nov 2018 17:23:27 +0000 Subject: [PATCH] Support of macOS 10.14 Mojave: better implementation of the Cairo-FLTK interface. This implementation puts all code related to Cairo support under Mojave in the Cairo-specific source file cairo/Fl_Cairo.cxx, which is preferable. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13116 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- cairo/Fl_Cairo.cxx | 7 +++++++ src/Fl_cocoa.mm | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cairo/Fl_Cairo.cxx b/cairo/Fl_Cairo.cxx index 6207d3c2e..f627c1caa 100644 --- a/cairo/Fl_Cairo.cxx +++ b/cairo/Fl_Cairo.cxx @@ -106,6 +106,13 @@ 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((CGContext*) 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 1c2342c21..d5e3804aa 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3537,13 +3537,6 @@ void Fl_Window::make_current() #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 if (views_use_CA) { i->gc = ((FLView*)[fl_window contentView])->layer_gc; -# ifdef FLTK_HAVE_CAIRO - // make sure the GC starts with an identity transformation matrix as do native Cocoa GC's - CGAffineTransform mat = CGContextGetCTM(i->gc); - if (!CGAffineTransformIsIdentity(mat)) { // 10.4 - CGContextConcatCTM(i->gc, CGAffineTransformInvert(mat)); - } -# endif } else #endif {