Turn g_dpi into a float, because why not

This commit is contained in:
Henrik Rydgård 2017-08-07 12:16:08 +02:00
parent d44309405a
commit 11c75476f7
5 changed files with 10 additions and 25 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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 file

@ -174,8 +174,8 @@ static GraphicsContext *graphicsContext;
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;