diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index dbf197d4cb..702c97585a 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -80,9 +80,7 @@ int Win32_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_Windo if ((shaper == NULL) || (shape == NULL) || - ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) || - (shape->w != shaper->window->w) || - (shape->h != shaper->window->h)) { + ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey))) { return SDL_INVALID_SHAPE_ARGUMENT; } diff --git a/test/testshape.c b/test/testshape.c index 939e0c9785..e846e1b14a 100644 --- a/test/testshape.c +++ b/test/testshape.c @@ -42,6 +42,7 @@ int main(int argc, char **argv) Uint8 num_pictures; LoadedPicture *pictures; int i, j; + const SDL_DisplayMode *mode; SDL_PixelFormat *format = NULL; SDL_Window *window; SDL_Renderer *renderer; @@ -66,6 +67,12 @@ int main(int argc, char **argv) exit(-2); } + mode = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay()); + if (!mode) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get desktop display mode: %s", SDL_GetError()); + exit(-2); + } + num_pictures = argc - 1; pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture) * num_pictures); if (pictures == NULL) { @@ -151,7 +158,8 @@ int main(int argc, char **argv) button_down = 0; SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name); SDL_QueryTexture(pictures[current_picture].texture, &pixelFormat, &access, &w, &h); - SDL_SetWindowSize(window, w, h); + /* We want to set the window size in pixels */ + SDL_SetWindowSize(window, (int)SDL_ceilf(w / mode->display_scale), (int)SDL_ceilf(h / mode->display_scale)); SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode); while (should_exit == 0) { while (SDL_PollEvent(&event)) { @@ -170,7 +178,7 @@ int main(int argc, char **argv) } SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Changing to shaped bmp: %s", pictures[current_picture].name); SDL_QueryTexture(pictures[current_picture].texture, &pixelFormat, &access, &w, &h); - SDL_SetWindowSize(window, w, h); + SDL_SetWindowSize(window, (int)SDL_ceilf(w / mode->display_scale), (int)SDL_ceilf(h / mode->display_scale)); SDL_SetWindowShape(window, pictures[current_picture].surface, &pictures[current_picture].mode); } if (event.type == SDL_EVENT_QUIT) {