From ff20361f5ab219f5ab2b5204addf548b82c58105 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 8 Nov 2018 17:09:24 +0000 Subject: Support of macOS 10.14 Mojave: take care of the FLTK-Cairo interface. Discussion "Screen buffer flipped in OSX Mojave running 1.4.x" in fltk.general, http://www.fltk.org/newsgroups.php?s36913+gfltk.general+v36915 describes a Cairo-using FLTK app that runs well after this modification. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13115 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- cairo/Fl_Cairo.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cairo/Fl_Cairo.cxx b/cairo/Fl_Cairo.cxx index f94e1edf3..b6807a2ea 100644 --- a/cairo/Fl_Cairo.cxx +++ b/cairo/Fl_Cairo.cxx @@ -103,7 +103,14 @@ 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__) - return cairo_quartz_surface_create_for_cg_context((CGContext*) gc, W, H); + 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. # endif -- cgit v1.2.3