From 435d135825fd276edc5246a55f37b6873feb2ae2 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 13 Sep 2017 16:15:34 +0000 Subject: SVG support: draw images at full screen resolution also when there are several pixels per graphical unit, as with Apple retina displays. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12456 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 1 + src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/drivers') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index c13c5ed05..3335a39ff 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -96,6 +96,7 @@ public: virtual void open_display_platform(); // --- compute dimensions of an Fl_Offscreen virtual void offscreen_size(Fl_Offscreen o, int &width, int &height); + virtual float retina_factor() { return 2; } }; diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index e4445ced3..117e2cb8a 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -202,7 +202,8 @@ int Fl_Quartz_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP CGContextClipToRect(gc_, CGRectMake(X, Y, W, H)); // this clip path will be rescaled & translated CGContextTranslateCTM(gc_, XP, YP); CGContextScaleCTM(gc_, float(WP)/img->w(), float(HP)/img->h()); - img->draw(0, 0, img->w(), img->h(), 0, 0); + if (img->as_rgb_image()) draw(img->as_rgb_image(), 0, 0, img->w(), img->h(), 0, 0); + else img->draw(0, 0, img->w(), img->h(), 0, 0); CGContextRestoreGState(gc_); fl_pop_clip(); // restore FLTK's clip return 1; -- cgit v1.2.3