Commit 613955b4f26553f66a29201ee2c9774318e0c91b

Charlie Birks 2017-02-17T10:13:07

Emscripten: only update pixel ratio if HiDPI is enabled

diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 78776ae..ad8cf91 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -556,7 +556,9 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u
     SDL_WindowData *window_data = userData;
 
     /* update pixel ratio */
-    window_data->pixel_ratio = emscripten_get_device_pixel_ratio();
+    if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+        window_data->pixel_ratio = emscripten_get_device_pixel_ratio();
+    }
 
     if(!(window_data->window->flags & FULLSCREEN_MASK))
     {
diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c
index 54936b7..fd1a3c0 100644
--- a/src/video/emscripten/SDL_emscriptenvideo.c
+++ b/src/video/emscripten/SDL_emscriptenvideo.c
@@ -263,7 +263,9 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window)
     if (window->driverdata) {
         data = (SDL_WindowData *) window->driverdata;
         /* update pixel ratio */
-        data->pixel_ratio = emscripten_get_device_pixel_ratio();
+        if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
+            data->pixel_ratio = emscripten_get_device_pixel_ratio();
+        }
         emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio);
 
         /*scale canvas down*/