mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-27 23:19:11 +00:00
tests: Fix tests when run with the --high-pixel-density flag
Scales pointer coordinates where needed to fix the following tests when run with the --high-pixel-density flag: - testaudio - testaudiostreamdynamicresample - testhittesting - testintersections - testmanymouse - testoverlay - testwm
This commit is contained in:
parent
745d5e4991
commit
fd0ce75e2e
7 changed files with 33 additions and 6 deletions
|
@ -33,17 +33,25 @@ static SDL_HitTestResult SDLCALL
|
|||
hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
|
||||
{
|
||||
int i;
|
||||
int w, h;
|
||||
int w, h, p_w;
|
||||
SDL_Point adj_pt;
|
||||
float scale;
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetWindowSizeInPixels(window, &p_w, NULL);
|
||||
|
||||
scale = (float)p_w / (float)w;
|
||||
|
||||
adj_pt.x = (int)SDL_floorf(pt->x * scale);
|
||||
adj_pt.y = (int)SDL_floorf(pt->y * scale);
|
||||
|
||||
for (i = 0; i < numareas; i++) {
|
||||
if (SDL_PointInRect(pt, &areas[i])) {
|
||||
if (SDL_PointInRect(&adj_pt, &areas[i])) {
|
||||
SDL_Log("HIT-TEST: DRAGGABLE\n");
|
||||
return SDL_HITTEST_DRAGGABLE;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
|
||||
#define REPORT_RESIZE_HIT(name) \
|
||||
{ \
|
||||
SDL_Log("HIT-TEST: RESIZE_" #name "\n"); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue