summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-11-08 17:09:24 +0000
committerManolo Gouy <Manolo>2018-11-08 17:09:24 +0000
commitff20361f5ab219f5ab2b5204addf548b82c58105 (patch)
tree249fbc4bf9dccd19c2cf0ce75caa60e3b7432bf8
parent055de59c1d51eb55068fb3f033c4eb29952b6762 (diff)
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
-rw-r--r--cairo/Fl_Cairo.cxx9
1 files changed, 8 insertions, 1 deletions
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