From a66fea75278c2c0aedb1166faa3cdd27a637e14f Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 15 Mar 2020 08:16:44 +0100 Subject: [PATCH] Minor rewriting for more readable code. --- src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index 61d44f6fd..c9f8fdda3 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -252,9 +252,10 @@ 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) { - float s = Fl_Surface_Device::surface()->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); + // the current surface is generally the display, but is an Fl_Image_Surface when scrolling an Fl_Overlay_Window + Fl_Quartz_Graphics_Driver *qgd = (Fl_Quartz_Graphics_Driver*)Fl_Surface_Device::surface()->driver(); + float s = qgd->scale(); + qgd->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;