diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-05-21 21:17:11 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-05-21 21:17:11 +0200 |
| commit | 9b80a38345d2197654c4610f3d3812e27a301c36 (patch) | |
| tree | 64e61aa88d8c5d872f03eff60e28592d3e9938da /src/drivers/Cocoa | |
| parent | 07f4fd43802183721e3e69f2d828af5f5820ea5a (diff) | |
Support for fl_scroll() under macOS when GUI is scaled
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 4df52f15d..97308e666 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -26,6 +26,7 @@ #include <FL/fl_draw.H> #include <FL/Fl.H> #include <FL/platform.H> +#include <math.h> /** \cond DriverDev @@ -260,7 +261,9 @@ int Fl_Cocoa_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, i { CGImageRef img = CGImage_from_window_rect(src_x, src_y, src_w, src_h); if (img) { - ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(img,dest_x,dest_y,src_w,src_h,0,0,src_w,src_h); + float s = Fl_Graphics_Driver::default_driver().scale(); + ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(img, + dest_x, dest_y, lround(s*src_w), lround(s*src_h), 0, 0, src_w, src_h); CFRelease(img); } return 0; |
