diff --git a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c index 64a399bde..66328af32 100644 --- a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c +++ b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenevents.c @@ -587,24 +587,13 @@ Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *u double w = window_data->window->w; double h = window_data->window->h; - if(window_data->external_size) { - emscripten_get_element_css_size(window_data->canvas_id, &w, &h); - } - - emscripten_set_canvas_element_size(window_data->canvas_id, w * window_data->pixel_ratio, h * window_data->pixel_ratio); - - /* set_canvas_size unsets this */ - if (!window_data->external_size && window_data->pixel_ratio != 1.0f) { - emscripten_set_element_css_size(window_data->canvas_id, w, h); - } - if (force) { /* force the event to trigger, so pixel ratio changes can be handled */ window_data->window->w = 0; window_data->window->h = 0; } - SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, w, h); + SDL_SendWindowEvent(window_data->window, SDL_WINDOWEVENT_RESIZED, 320, 240); } } diff --git a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c index e20d7a985..ad9b33cbc 100644 --- a/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c +++ b/ion/src/simulator/external/sdl/src/video/emscripten/SDL_emscriptenvideo.c @@ -197,38 +197,12 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } wdata->canvas_id = SDL_strdup("#canvas"); + wdata->pixel_ratio = 320 / 240; - if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - wdata->pixel_ratio = emscripten_get_device_pixel_ratio(); - } else { - wdata->pixel_ratio = 1.0f; - } + window->w = 320; + window->h = 240; - scaled_w = SDL_floor(window->w * wdata->pixel_ratio); - scaled_h = SDL_floor(window->h * wdata->pixel_ratio); - - /* set a fake size to check if there is any CSS sizing the canvas */ - emscripten_set_canvas_element_size(wdata->canvas_id, 1, 1); - emscripten_get_element_css_size(wdata->canvas_id, &css_w, &css_h); - - wdata->external_size = SDL_floor(css_w) != 1 || SDL_floor(css_h) != 1; - - if ((window->flags & SDL_WINDOW_RESIZABLE) && wdata->external_size) { - /* external css has resized us */ - scaled_w = css_w * wdata->pixel_ratio; - scaled_h = css_h * wdata->pixel_ratio; - - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, css_w, css_h); - } - emscripten_set_canvas_element_size(wdata->canvas_id, scaled_w, scaled_h); - - /* if the size is not being controlled by css, we need to scale down for hidpi */ - if (!wdata->external_size) { - if (wdata->pixel_ratio != 1.0f) { - /*scale canvas down*/ - emscripten_set_element_css_size(wdata->canvas_id, window->w, window->h); - } - } + emscripten_set_canvas_element_size(wdata->canvas_id, 320, 240); #if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) {