mirror of
https://github.com/fltk/fltk.git
synced 2026-05-26 18:17:03 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user