We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2565 - SDL_RenderSetLogicalSize stretches render with SDL_WINDOW_ALLOW_HIGHDPI when window is resized and moved
Summary: SDL_RenderSetLogicalSize stretches render with SDL_WINDOW_ALLOW_HIGHDPI when ...
Status: WAITING
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86_64 Mac OS X 10.8
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-30 17:27 UTC by Diego
Modified: 2017-08-21 13:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego 2014-05-30 17:27:15 UTC
When a window is created with SDL_WINDOW_ALLOW_HIGHDPI and SDL_RenderSetLogicalSize is set on the renderer, resizing the window changes the scale and letterboxing correctly,  but if the window is then dragged and moved, the letterbox disappears and the renderer is stretched to the window size.
The following test code produces the stretching for me.
Removing SDL_WINDOW_ALLOW_HIGHDPI from the window flags produces no stretching. 

////CODE
#include <stdio.h>
#include "SDL.h"

int main(int argc, char *argv[]) {
    
    if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
        printf("Could not initialize SDL\n");
        return 1;
    }
    
    SDL_Window *window = SDL_CreateWindow("Title", 100,100,100,100, SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE|SDL_WINDOW_ALLOW_HIGHDPI);
    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
    SDL_RenderSetLogicalSize(renderer, 100,100);
    
    SDL_bool running = SDL_TRUE;
    while (running) {
        
        SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
        SDL_RenderClear(renderer);
        SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
        SDL_RenderFillRect(renderer, NULL);
        SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
        SDL_RenderFillRect(renderer, &(SDL_Rect){0,0,50,50});
        SDL_RenderPresent(renderer);
        
        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            if (event.type == SDL_QUIT) {
                running = SDL_FALSE;
                break;
            }
        }
        
        SDL_Delay(100);
    }
    
    return 0;
}
Comment 1 Sam Lantinga 2017-08-14 13:04:53 UTC
This should be fixed with the latest SDL snapshot, can you please confirm?
http://www.libsdl.org/tmp/SDL-2.0.zip
Comment 2 Diego 2017-08-21 13:23:53 UTC
No this is still not fixed with the latest commit.