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
This commit is contained in:
Manolo Gouy 2018-11-08 17:09:24 +00:00
parent 055de59c1d
commit ff20361f5a
1 changed files with 8 additions and 1 deletions

View File

@ -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