From 22596d3f5ffb014831e82b78438cb7e8b3fe75a4 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 22 Jun 2016 07:45:53 +0000 Subject: Make Fl_Gl_Window::pixels_per_unit() return a float (rather than int) value. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11794 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Gl_Window.H | 6 +++--- FL/Fl_Gl_Window_Driver.H | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H index aed24edcd..135a343fa 100644 --- a/FL/Fl_Gl_Window.H +++ b/FL/Fl_Gl_Window.H @@ -208,7 +208,7 @@ public: // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. virtual Fl_Gl_Window* as_gl_window() {return this;} - int pixels_per_unit(); + float pixels_per_unit(); /** Gives the window width in OpenGL pixels. Generally identical with the result of the w() function, but for a window mapped to an Apple 'retina' display, and if Fl::use_high_res_GL(bool) is set to true, @@ -216,7 +216,7 @@ public: between low and high resolution displays and automatically adjusts the returned value. \version 1.3.4 */ - int pixel_w() { return pixels_per_unit() * w(); } + int pixel_w() { return int(pixels_per_unit() * w() + 0.5f); } /** Gives the window height in OpenGL pixels. Generally identical with the result of the h() function, but for a window mapped to an Apple 'retina' display, and if Fl::use_high_res_GL(bool) is set to true, @@ -224,7 +224,7 @@ public: between low and high resolution displays and automatically adjusts the returned value. \version 1.3.4 */ - int pixel_h() { return pixels_per_unit() * h(); } + int pixel_h() { return int(pixels_per_unit() * h() + 0.5f); } ~Fl_Gl_Window(); /** diff --git a/FL/Fl_Gl_Window_Driver.H b/FL/Fl_Gl_Window_Driver.H index 35e3f3390..db8702185 100644 --- a/FL/Fl_Gl_Window_Driver.H +++ b/FL/Fl_Gl_Window_Driver.H @@ -49,7 +49,7 @@ public: virtual ~Fl_Gl_Window_Driver() {} static Fl_Gl_Window_Driver *newGlWindowDriver(Fl_Gl_Window *w); static Fl_Gl_Window_Driver *global(); - virtual int pixels_per_unit() {return 1;} + virtual float pixels_per_unit() {return 1;} virtual void before_show(int& need_redraw) {} virtual void after_show(int need_redraw) {} virtual void invalidate(); @@ -95,7 +95,7 @@ class NSOpenGLPixelFormat; class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver { friend class Fl_Gl_Window_Driver; Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} - virtual int pixels_per_unit(); + virtual float pixels_per_unit(); virtual void before_show(int& need_redraw); virtual void after_show(int need_redraw); virtual int mode_(int m, const int *a); -- cgit v1.2.3