From 88f20cfd15237f150a4cb97bce5cd64b7a81a572 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 15 Feb 2016 17:21:23 +0000 Subject: Improve image drawing to double-resolution Fl_Image_Surface objects (Mac OS only). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11180 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 2 +- src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index f97dabf04..e1fa62e42 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -338,7 +338,7 @@ void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int } else if (at.a == 0.5) { doit = true; if (Fl_Display_Device::high_resolution()) { // make .tx and .ty have int or half-int values - deltax = (at.tx*2 - round(at.tx*2)); + deltax = -(at.tx*2 - round(at.tx*2)); deltay = (at.ty*2 - round(at.ty*2)); } else { // make .tx and .ty have integral values deltax = (at.tx - round(at.tx))*2; diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx index aa84d7777..e0a3a50ee 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx @@ -281,10 +281,11 @@ void Fl_Quartz_Graphics_Driver::restore_clip() { if ( ! fl_window ) { // a bitmap context CGFloat hgt = CGBitmapContextGetHeight(fl_gc); CGAffineTransform at = CGContextGetCTM(fl_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; - } - CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f); + offset /= at.a; } + CGContextTranslateCTM(fl_gc, offset, hgt-offset); CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context } color(color()); -- cgit v1.2.3