diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm | 6 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 8 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 9 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 3 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 5 |
10 files changed, 20 insertions, 21 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm index 38c3075c5..607aed8fc 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm @@ -19,6 +19,7 @@ #include <FL/Fl_Printer.H> #include <FL/Fl_Shared_Image.H> #include <FL/Fl_Window_Driver.H> +#include <FL/Fl_Screen_Driver.H> #include "../Quartz/Fl_Quartz_Graphics_Driver.H" #include "../Darwin/Fl_Darwin_System_Driver.H" #include "Fl_Cocoa_Window_Driver.H" @@ -401,8 +402,9 @@ void Fl_Cocoa_Printer_Driver::draw_decorated_window(Fl_Window *win, int x_offset CGContextRef gc = (CGContextRef)driver()->gc(); CGContextSaveGState(gc); CGContextTranslateCTM(gc, x_offset - 0.5, y_offset + bt - 0.5); - CGContextScaleCTM(gc, 1, -1); - Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w(), bt); + float s = Fl::screen_driver()->scale(win->driver()->screen_num()); + CGContextScaleCTM(gc, 1/s, -1/s); + Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w() * s, bt); CGContextRestoreGState(gc); } else { diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 3335a39ff..5e318a2e3 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -4,7 +4,7 @@ // Definition of Apple Cocoa Screen interface // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2016 by Bill Spitzak and others. +// Copyright 2010-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -97,6 +97,12 @@ public: // --- compute dimensions of an Fl_Offscreen virtual void offscreen_size(Fl_Offscreen o, int &width, int &height); virtual float retina_factor() { return 2; } + + virtual APP_SCALING_CAPABILITY rescalable() { return SYSTEMWIDE_APP_SCALING; } + virtual float scale(int n) {return scale_;} + virtual void scale(int n, float f) { scale_ = f;} +private: + float scale_; }; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 7c8119ca1..e4f86aa90 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -99,10 +99,11 @@ void Fl_Cocoa_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H, int n) if ((n < 0) || (n >= num_screens)) n = 0; - X = screens[n].x; - Y = screens[n].y; - W = screens[n].width; - H = screens[n].height; + float s = scale(0); + X = screens[n].x/s; + Y = screens[n].y/s; + W = screens[n].width/s; + H = screens[n].height/s; } diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx index 131edcd7f..017302be7 100644 --- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx @@ -62,7 +62,7 @@ Fl_GDI_Copy_Surface_Driver::Fl_GDI_Copy_Surface_Driver(int w, int h) : Fl_Copy_S // Global display scaling factor: 1, 1.25, 1.5, 1.75, etc... #ifdef FLTK_HIDPI_SUPPORT float scaling = Fl_Graphics_Driver::default_driver().scale(); - driver()->scale(scaling); + ((Fl_GDI_Graphics_Driver*)driver())->scale(scaling); #else float scaling = 1/((Fl_WinAPI_Screen_Driver*)Fl::screen_driver())->DWM_scaling_factor(); #endif diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 967800a52..30ff4aa32 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -93,7 +93,6 @@ public: void untranslate_all(void); static HRGN scale_region(HRGN r, float f, Fl_GDI_Graphics_Driver *dr); virtual void scale(float f); - virtual float scale(); protected: void transformed_vertex0(float x, float y); void fixloop(); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index 73d9498d2..c6b7026f8 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -236,10 +236,6 @@ void Fl_GDI_Graphics_Driver::scale(float f) { } } -float Fl_GDI_Graphics_Driver::scale() { - return scale_; -} - /* Rescale region r with factor f and returns the scaled region. Region r is returned unchanged if r is null or f is 1. diff --git a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx index 6b851e4a8..23ad79d04 100644 --- a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx @@ -58,7 +58,7 @@ Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_ offscreen = off ? off : CreateCompatibleBitmap( (gc ? gc : fl_GetDC(0) ) , w, h); if (!offscreen) offscreen = CreateCompatibleBitmap(fl_GetDC(0), w, h); driver(new Fl_GDI_Graphics_Driver); - if (d != 1 && high_res) driver()->scale(d); + if (d != 1 && high_res) ((Fl_GDI_Graphics_Driver*)driver())->scale(d); origin.x = origin.y = 0; } diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index f459524ec..e796f3860 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -28,6 +28,7 @@ #include <FL/x.H> #include "Fl_WinAPI_Window_Driver.H" #include "Fl_WinAPI_Screen_Driver.H" +#include "../GDI/Fl_GDI_Graphics_Driver.H" #include <windows.h> #include <math.h> // for ceil() @@ -415,7 +416,7 @@ void Fl_WinAPI_Window_Driver::make_current() { #endif // USE_COLORMAP fl_graphics_driver->clip_region(0); - fl_graphics_driver->scale(Fl::screen_driver()->scale(screen_num())); + ((Fl_GDI_Graphics_Driver*)fl_graphics_driver)->scale(Fl::screen_driver()->scale(screen_num())); } void Fl_WinAPI_Window_Driver::label(const char *name,const char *iname) { diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index 473da8333..c274edc8b 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -105,7 +105,6 @@ public: void translate_all(int dx, int dy); void untranslate_all(); virtual void scale(float f); - virtual float scale(); virtual int has_feature(driver_feature mask) { return mask & NATIVE; } virtual void *gc() { return gc_; } virtual void gc(void *value); diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 9b4138055..876c20619 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -100,11 +100,6 @@ void Fl_Xlib_Graphics_Driver::scale(float f) { #endif } - -float Fl_Xlib_Graphics_Driver::scale() { - return scale_; -} - void Fl_Xlib_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { XCopyArea(fl_display, pixmap, fl_window, gc_, srcx*scale_, srcy*scale_, w*scale_, h*scale_, (x+offset_x_)*scale_, (y+offset_y_)*scale_); |
