diff options
| author | Manolo Gouy <Manolo> | 2017-12-18 08:52:55 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-12-18 08:52:55 +0000 |
| commit | 3f9f4debbba0527658ce09044fbff90e332235cc (patch) | |
| tree | a3a4852ab786012432666a1fe07fdca9f05387dc /FL/Fl_Graphics_Driver.H | |
| parent | 31f16205cb31d724ee93444f5b9b17e7fa3ae3b1 (diff) | |
STR#3444: Add MacOS support for application rescaling (not quite complete)
With this, most MacOS FLTK app can be scaled with command/+/-/0/ keystrokes.
A scaling problem remains, visible in test/cube, where the "Test" string is not positioned correctly.
GLUT apps can also be scaled (across platforms).
SVG images are re-rasterized after app scaling for optimal drawing.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12594 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Graphics_Driver.H')
| -rw-r--r-- | FL/Fl_Graphics_Driver.H | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 1d740a055..e998985b6 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -77,6 +77,8 @@ struct Fl_Fontdesc; class FL_EXPORT Fl_Graphics_Driver { friend class Fl_Surface_Device; friend class Fl_Display_Device; + friend class Fl_Screen_Driver; + friend class Fl_Window_Driver; friend class Fl_Pixmap; friend class Fl_Bitmap; friend class Fl_RGB_Image; @@ -93,6 +95,10 @@ class FL_EXPORT Fl_Graphics_Driver { private: // some platforms may need to reimplement this virtual void set_current_(); +protected: + float scale_; // scale between user and graphical coordinates: graphical = user * scale_ + /** Sets the current value of the scaling factor */ + virtual void scale(float f) { scale_ = f; } public: // The following functions create the various graphics drivers that are required // for core operations. They must be implemented as members of Fl_Graphics_Driver, @@ -218,6 +224,8 @@ public: Fl_Graphics_Driver(); virtual ~Fl_Graphics_Driver() {} ///< Destructor static Fl_Graphics_Driver &default_driver(); + /** Current scale factor between FLTK and graphical coordinates: graphical = FLTK * scale() */ + float scale() { return scale_; } /** Return whether the graphics driver can do alpha blending */ virtual char can_do_alpha_blending() { return 0; } // --- implementation is in src/fl_rect.cxx which includes src/drivers/xxx/Fl_xxx_Graphics_Driver_rect.cxx @@ -370,10 +378,6 @@ public: virtual void add_rectangle_to_region(Fl_Region r, int x, int y, int w, int h); virtual Fl_Region XRectangleRegion(int x, int y, int w, int h); virtual void XDestroyRegion(Fl_Region r); - /** Returns the current value of the scaling factor (usually > 1 on HiDPI displays) */ - virtual float scale() {return 1;} - /** Sets the current value of the scaling factor */ - virtual void scale(float f) {} /** Support for Fl::get_font_name() */ virtual const char* get_font_name(Fl_Font fnum, int* ap) {return NULL;} /** Support for Fl::get_font_sizes() */ @@ -411,9 +415,7 @@ public: class FL_EXPORT Fl_Scalable_Graphics_Driver : public Fl_Graphics_Driver { public: Fl_Scalable_Graphics_Driver(); - float scale() { return scale_; } protected: - float scale_; // scale between user and graphical coordinates: graphical = user * scale_ int line_width_; void cache_size(Fl_Image *img, int &width, int &height); virtual Fl_Region scale_clip(float f)=0; |
