Permalink
Browse files

Turn g_dpi into a float, because why not

  • Loading branch information...
hrydgard committed Aug 7, 2017
1 parent d443094 commit 11c75476f7ebd52d6bb80ec5e608d04126c6efc8
Showing with 10 additions and 25 deletions.
  1. +2 −2 Core/Core.cpp
  2. +4 −19 android/jni/app-android.cpp
  3. +1 −1 ext/native/base/display.cpp
  4. +1 −1 ext/native/base/display.h
  5. +2 −2 ios/ViewController.mm
View
@@ -141,10 +141,10 @@ static bool IsWindowSmall(int pixelWidth, int pixelHeight) {
bool UpdateScreenScale(int width, int height) {
bool smallWindow;
#ifdef _WIN32
g_dpi = System_GetPropertyInt(SYSPROP_DISPLAY_DPI);
g_dpi = (float)System_GetPropertyInt(SYSPROP_DISPLAY_DPI);
g_dpi_scale = 96.0f / g_dpi;
#else
g_dpi = 96;
g_dpi = 96.0f;
g_dpi_scale = 1.0f;
#endif
g_dpi_scale_real = g_dpi_scale;
@@ -701,26 +701,11 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env,
extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayResize(JNIEnv *, jobject clazz, jint w, jint h, jint dpi, jfloat refreshRate) {
ILOG("NativeApp.displayResize(%i x %i, dpi=%i, refresh=%0.2f)", w, h, dpi, refreshRate);
/*
g_dpi = dpi;
g_dpi_scale = 240.0f / (float)g_dpi;
g_dpi_scale_real = g_dpi_scale;
pixel_xres = w;
pixel_yres = h;
dp_xres = pixel_xres * g_dpi_scale;
dp_yres = pixel_yres * g_dpi_scale;
dp_xscale = (float)dp_xres / pixel_xres;
dp_yscale = (float)dp_yres / pixel_yres;
*/
// display_hz = refreshRate;
pixel_xres = w;
pixel_yres = h;
// backbuffer_format = format;
g_dpi = (int)display_dpi;
g_dpi_scale = 240.0f / (float)g_dpi;
g_dpi = display_dpi;
g_dpi_scale = 240.0f / g_dpi;
g_dpi_scale_real = g_dpi_scale;
dp_xres = display_xres * g_dpi_scale;
@@ -988,8 +973,8 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv
pixel_yres = bufh;
backbuffer_format = format;
g_dpi = (int)display_dpi;
g_dpi_scale = 240.0f / (float)g_dpi;
g_dpi = (float)display_dpi;
g_dpi_scale = 240.0f / g_dpi;
g_dpi_scale_real = g_dpi_scale;
dp_xres = display_xres * g_dpi_scale;
@@ -6,7 +6,7 @@ int dp_yres;
int pixel_xres;
int pixel_yres;
int g_dpi = 1; // will be overwritten
float g_dpi = 1.0f; // will be overwritten with a value that makes sense.
float g_dpi_scale = 1.0f;
float g_dpi_scale_real = 1.0f;
float pixel_in_dps = 1.0f;
@@ -10,7 +10,7 @@ extern int dp_yres;
extern int pixel_xres;
extern int pixel_yres;
extern int g_dpi;
extern float g_dpi;
extern float g_dpi_scale;
extern float g_dpi_scale_real;
extern float pixel_in_dps;
View
@@ -174,8 +174,8 @@ - (void)viewDidLoad {
size.width = h;
}
g_dpi = (IS_IPAD() ? 200 : 150) * scale;
g_dpi_scale = 240.0f / (float)g_dpi;
g_dpi = (IS_IPAD() ? 200.0f : 150.0f) * scale;
g_dpi_scale = 240.0f / g_dpi;
g_dpi_scale_real = g_dpi_scale;
pixel_xres = size.width * scale;
pixel_yres = size.height * scale;

0 comments on commit 11c7547

Please sign in to comment.