mirror of https://github.com/libsdl-org/SDL.git
test: Fix testcustomcursor on high-DPI displays
Use the backbuffer dimensions and scale the chessboard pattern to draw it filling the window on scaled displays.
This commit is contained in:
parent
3b3c4a79b6
commit
522321b7c9
|
|
@ -341,10 +341,11 @@ static void loop(void)
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
int x, y, row;
|
int x, y, row;
|
||||||
int window_w = 0, window_h = 0;
|
int window_w = 0, window_h = 0;
|
||||||
|
const float scale = SDL_GetWindowPixelDensity(state->windows[i]);
|
||||||
|
|
||||||
SDL_GetWindowSize(state->windows[i], &window_w, &window_h);
|
SDL_GetWindowSizeInPixels(state->windows[i], &window_w, &window_h);
|
||||||
rect.w = 128.0f;
|
rect.w = 128.0f * scale;
|
||||||
rect.h = 128.0f;
|
rect.h = 128.0f * scale;
|
||||||
for (y = 0, row = 0; y < window_h; y += (int)rect.h, ++row) {
|
for (y = 0, row = 0; y < window_h; y += (int)rect.h, ++row) {
|
||||||
bool black = ((row % 2) == 0) ? true : false;
|
bool black = ((row % 2) == 0) ? true : false;
|
||||||
for (x = 0; x < window_w; x += (int)rect.w) {
|
for (x = 0; x < window_w; x += (int)rect.w) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue