|
@@ -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) {
|