summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-21 21:17:11 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-21 21:17:11 +0200
commit9b80a38345d2197654c4610f3d3812e27a301c36 (patch)
tree64e61aa88d8c5d872f03eff60e28592d3e9938da /src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
parent07f4fd43802183721e3e69f2d828af5f5820ea5a (diff)
Support for fl_scroll() under macOS when GUI is scaled
Diffstat (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
index bb4240864..71fc08637 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
@@ -280,32 +280,9 @@ void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int
CGContextClipToRect(gc_, CGRectOffset(rect, -0.5, -0.5 ));
// move graphics context to origin of vertically reversed image
// The 0.5 here cancels the 0.5 offset present in Quartz graphics contexts.
- // Thus, image and surface pixels are in phase if there's no scaling.
+ // Thus, image and surface pixels are in phase.
CGContextTranslateCTM(gc_, rect.origin.x - srcx - 0.5, rect.origin.y - srcy + sh - 0.5);
CGContextScaleCTM(gc_, 1, -1);
- CGAffineTransform at = CGContextGetCTM(gc_);
- if (at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation
- // We handle x2 and /2 scalings that occur when drawing to
- // a double-resolution bitmap, and when drawing a double-resolution bitmap to display.
- bool doit = false;
- // phase image with display pixels
- CGFloat deltax = 0, deltay = 0;
- if (at.a == 2) { // make .tx and .ty have even values
- deltax = (at.tx/2 - round(at.tx/2));
- deltay = (at.ty/2 - round(at.ty/2));
- doit = true;
- } else if (at.a == 0.5) {
- doit = true;
- if (high_resolution()) { // make .tx and .ty have int or half-int values
- 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;
- deltay = (at.ty - round(at.ty))*2;
- }
- }
- if (doit) CGContextTranslateCTM(gc_, -deltax, -deltay);
- }
CGContextDrawImage(gc_, CGRectMake(0, 0, sw, sh), cgimg);
CGContextRestoreGState(gc_);
}