mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-08 14:23:22 +00:00
Removed SDL_GetDisplayDPI()
This function wasn't consistently correct across platforms and devices. If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
This commit is contained in:
@@ -39,7 +39,6 @@ static int Emscripten_VideoInit(_THIS);
|
||||
static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
|
||||
static void Emscripten_VideoQuit(_THIS);
|
||||
static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
|
||||
static int Emscripten_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
|
||||
|
||||
static int Emscripten_CreateWindow(_THIS, SDL_Window *window);
|
||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window *window);
|
||||
@@ -77,7 +76,6 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void)
|
||||
device->VideoInit = Emscripten_VideoInit;
|
||||
device->VideoQuit = Emscripten_VideoQuit;
|
||||
device->GetDisplayUsableBounds = Emscripten_GetDisplayUsableBounds;
|
||||
device->GetDisplayPhysicalDPI = Emscripten_GetDisplayPhysicalDPI;
|
||||
device->SetDisplayMode = Emscripten_SetDisplayMode;
|
||||
|
||||
device->PumpEvents = Emscripten_PumpEvents;
|
||||
@@ -168,26 +166,6 @@ static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, S
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Emscripten_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi_out, float *hdpi_out, float *vdpi_out)
|
||||
{
|
||||
const float dpi_reference = 96.0f;
|
||||
float dpi;
|
||||
|
||||
dpi = (float)emscripten_get_device_pixel_ratio() * dpi_reference;
|
||||
|
||||
if (ddpi_out) {
|
||||
*ddpi_out = dpi;
|
||||
}
|
||||
if (hdpi_out) {
|
||||
*hdpi_out = dpi;
|
||||
}
|
||||
if (vdpi_out) {
|
||||
*vdpi_out = dpi;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Emscripten_PumpEvents(_THIS)
|
||||
{
|
||||
/* do nothing. */
|
||||
|
||||
Reference in New Issue
Block a user