Make Fl_Gl_Window::pixels_per_unit() return a float (rather than int) value.

This is compatible with future scaling factors applicable to the GUI.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11787 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2016-06-22 05:44:14 +00:00
parent e09806d249
commit 6b95819984
5 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ static Fl_RGB_Image* capture_gl_rectangle(Fl_Gl_Window *glw, int x, int y, int w
{
#if defined(__APPLE__)
const int bytesperpixel = 4;
int factor = glw->pixels_per_unit();
float factor = glw->pixels_per_unit();
if (factor > 1) {
w *= factor; h *= factor; x *= factor; y *= factor;
}
+1 -1
View File
@@ -96,7 +96,7 @@ void Fl_Gl_Window::show() {
#if defined(__APPLE__)
int Fl_Gl_Window::pixels_per_unit()
float Fl_Gl_Window::pixels_per_unit()
{
return (fl_mac_os_version >= 100700 && Fl::use_high_res_GL() && Fl_X::i(this) && Fl_X::i(this)->mapped_to_retina()) ? 2 : 1;
}
+3 -3
View File
@@ -83,9 +83,9 @@ int Fl_Glut_Window::handle(int event) {
make_current();
int ex = Fl::event_x();
int ey = Fl::event_y();
int factor = pixels_per_unit();
ex *= factor;
ey *= factor;
float factor = pixels_per_unit();
ex = int(ex * factor + 0.5);
ey = int(ey * factor + 0.5);
int button;
switch (event) {