Emscripten: only update pixel ratio if HiDPI is enabled
authorCharlie Birks <admin@daftgames.net>
Fri, 17 Feb 2017 10:13:07 +0000
changeset 10895fd63ed9b0746
parent 10894 748bedefb03f
child 10896 bc382771cd10
Emscripten: only update pixel ratio if HiDPI is enabled
src/video/emscripten/SDL_emscriptenevents.c
src/video/emscripten/SDL_emscriptenvideo.c
     1.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Fri Feb 17 02:25:37 2017 -0500
     1.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Fri Feb 17 10:13:07 2017 +0000
     1.3 @@ -556,7 +556,9 @@
     1.4      SDL_WindowData *window_data = userData;
     1.5  
     1.6      /* update pixel ratio */
     1.7 -    window_data->pixel_ratio = emscripten_get_device_pixel_ratio();
     1.8 +    if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
     1.9 +        window_data->pixel_ratio = emscripten_get_device_pixel_ratio();
    1.10 +    }
    1.11  
    1.12      if(!(window_data->window->flags & FULLSCREEN_MASK))
    1.13      {
     2.1 --- a/src/video/emscripten/SDL_emscriptenvideo.c	Fri Feb 17 02:25:37 2017 -0500
     2.2 +++ b/src/video/emscripten/SDL_emscriptenvideo.c	Fri Feb 17 10:13:07 2017 +0000
     2.3 @@ -263,7 +263,9 @@
     2.4      if (window->driverdata) {
     2.5          data = (SDL_WindowData *) window->driverdata;
     2.6          /* update pixel ratio */
     2.7 -        data->pixel_ratio = emscripten_get_device_pixel_ratio();
     2.8 +        if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
     2.9 +            data->pixel_ratio = emscripten_get_device_pixel_ratio();
    2.10 +        }
    2.11          emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio);
    2.12  
    2.13          /*scale canvas down*/