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
(cherry picked from commit ffd0ca4391)
This commit is contained in:
@@ -48,8 +48,6 @@ bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B)
|
|||||||
SDL_RECT_CAN_OVERFLOW(B)) {
|
SDL_RECT_CAN_OVERFLOW(B)) {
|
||||||
SDL_SetError("Potential rect math overflow");
|
SDL_SetError("Potential rect math overflow");
|
||||||
return false;
|
return false;
|
||||||
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) {
|
|
||||||
return false; // Special cases for empty rects
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal intersection
|
// Horizontal intersection
|
||||||
@@ -100,10 +98,6 @@ bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
|
|||||||
} else if (!result) {
|
} else if (!result) {
|
||||||
SDL_InvalidParamError("result");
|
SDL_InvalidParamError("result");
|
||||||
return false;
|
return false;
|
||||||
} else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { // Special cases for empty rects
|
|
||||||
result->w = 0;
|
|
||||||
result->h = 0;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal intersection
|
// Horizontal intersection
|
||||||
|
|||||||
Reference in New Issue
Block a user