fix hidpi?
This commit is contained in:
parent
3f8b135ddd
commit
30113e5ed3
@ -601,9 +601,14 @@ screen_convert_to_frame_coords(struct screen *screen, int32_t x, int32_t y) {
|
|||||||
int32_t w = screen->content_size.width;
|
int32_t w = screen->content_size.width;
|
||||||
int32_t h = screen->content_size.height;
|
int32_t h = screen->content_size.height;
|
||||||
|
|
||||||
// scale
|
// take the HiDPI scaling (dw/ww and dh/wh) into account
|
||||||
x = (x - screen->rect.x) * w / screen->rect.w;
|
int ww, wh, dw, dh;
|
||||||
y = (y - screen->rect.y) * h / screen->rect.h;
|
SDL_GetWindowSize(screen->window, &ww, &wh);
|
||||||
|
SDL_GL_GetDrawableSize(screen->window, &dw, &dh);
|
||||||
|
|
||||||
|
// scale (64 bits for intermediate multiplications)
|
||||||
|
x = (int64_t) (x - screen->rect.x) * w * dw / (screen->rect.w * ww);
|
||||||
|
y = (int64_t) (y - screen->rect.y) * h * dh / (screen->rect.h * wh);
|
||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
struct point result;
|
struct point result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user