Browse Source

Changing variable from float to int, this way we can check it's value without having to do an unnecessary conversion. Then do explicit conversions later on if we need.

Kyle Schaefer 4 năm trước cách đây
mục cha
commit
4522cb1df9
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      src/video/x11/SDL_x11modes.c

+ 4 - 4
src/video/x11/SDL_x11modes.c

@@ -440,7 +440,7 @@ X11_InitModes_XRandR(_THIS)
                 RRMode modeID;
                 RRCrtc output_crtc;
                 XRRCrtcInfo *crtc;
-                float xft_dpi;
+                int xft_dpi = 0;
 
                 /* The primary output _should_ always be sorted first, but just in case... */
                 if ((looking_for_primary && (res->outputs[output] != primary)) ||
@@ -497,10 +497,10 @@ X11_InitModes_XRandR(_THIS)
                 displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f);
 
                 /* if xft dpi is available we will use this over xrandr */
-                xft_dpi = (float)GetXftDPI(dpy);
+                xft_dpi = GetXftDPI(dpy);
                 if(xft_dpi > 0) {
-                    displaydata->hdpi = xft_dpi;
-                    displaydata->vdpi = xft_dpi;
+                    displaydata->hdpi = (float)xft_dpi;
+                    displaydata->vdpi = (float)xft_dpi;
                 }
 
                 displaydata->scanline_pad = scanline_pad;