mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-30 21:37:43 +08:00
Perform full rectangle intersection for empty rects
If we don't do that, we leave the x and y values uninitialized. Fixes https://github.com/libsdl-org/sdl12-compat/issues/365
This commit is contained in:
@@ -51,10 +51,6 @@ bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) {
|
|
||||||
return false; // Special cases for empty rects
|
|
||||||
}
|
|
||||||
|
|
||||||
// Horizontal intersection
|
// Horizontal intersection
|
||||||
Amin = A->x;
|
Amin = A->x;
|
||||||
Amax = Amin + A->w;
|
Amax = Amin + A->w;
|
||||||
@@ -107,12 +103,6 @@ bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { // Special cases for empty rects
|
|
||||||
result->w = 0;
|
|
||||||
result->h = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Horizontal intersection
|
// Horizontal intersection
|
||||||
Amin = A->x;
|
Amin = A->x;
|
||||||
Amax = Amin + A->w;
|
Amax = Amin + A->w;
|
||||||
|
|||||||
Reference in New Issue
Block a user