From e1893334fd1e2377635b6488945f730263b04fd9 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 23 Dec 2017 06:34:42 +0000 Subject: Continue support for GUI rescaling under MacOS: fix Fl_Overlay_Window. This patch also improves by simplification the code of class Fl_Quartz_Image_Surface_Driver: because, under the driver model, there's a separate graphics content for the display and for each offscreen buffer, it's possible to reverse the drawing orientation (draw from top to bottom) once at offscreen creation. It's thus no longer necessary to reverse orientation in Fl_Quartz_Graphics_Driver::restore_clip() specifically for offscreen buffers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12603 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | 13 ------------- src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx | 8 +++----- 2 files changed, 3 insertions(+), 18 deletions(-) (limited to 'src/drivers/Quartz') diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx index 4bfaa39dc..2a223bb9c 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx @@ -296,19 +296,6 @@ void Fl_Quartz_Graphics_Driver::restore_clip() { CGContextRestoreGState(gc_); CGContextSaveGState(gc_); } - // FLTK has only one global graphics state. - // This copies the FLTK state into the current Quartz context - if ( ! fl_window ) { // a bitmap context - CGFloat hgt = CGBitmapContextGetHeight(gc_); - CGAffineTransform at = CGContextGetCTM(gc_); - CGFloat offset = 0.5; - if (at.a != 1 && at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation - hgt /= at.a; - offset /= at.a; - } - CGContextTranslateCTM(gc_, offset, hgt-offset); - CGContextScaleCTM(gc_, 1.0f, -1.0f); // now 0,0 is top-left point of the context - } color(color()); quartz_restore_line_style(); if (r) { //apply program clip diff --git a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx index b31086b1f..c8d751aa1 100644 --- a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx @@ -57,9 +57,9 @@ Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int CGContextScaleCTM(offscreen, 2, 2); } CGContextSetShouldAntialias(offscreen, false); - CGContextSaveGState(offscreen); - CGContextTranslateCTM(offscreen, 0, height); + CGContextTranslateCTM(offscreen, 0, height); CGContextScaleCTM(offscreen, 1.0f, -1.0f); + CGContextSaveGState(offscreen); CGContextSetRGBFillColor(offscreen, 1, 1, 1, 0); CGContextFillRect(offscreen, CGRectMake(0,0,w,h)); } @@ -84,10 +84,8 @@ void Fl_Quartz_Image_Surface_Driver::set_current() { void Fl_Quartz_Image_Surface_Driver::translate(int x, int y) { CGContextRestoreGState(offscreen); CGContextSaveGState(offscreen); - CGContextTranslateCTM(offscreen, x, -y); + CGContextTranslateCTM(offscreen, x, y); CGContextSaveGState(offscreen); - CGContextTranslateCTM(offscreen, 0, height); - CGContextScaleCTM(offscreen, 1.0f, -1.0f); } void Fl_Quartz_Image_Surface_Driver::untranslate() { -- cgit v1.2.3