diff --git a/docs/README-migration.md b/docs/README-migration.md index 309d4a8e69..e72c900117 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -379,6 +379,26 @@ The following functions have been renamed: The preprocessor symbol __MACOSX__ has been renamed __MACOS__, and __IPHONEOS__ has been renamed __IOS__ +## SDL_rect.h + +The following functions have been renamed: +* SDL_EncloseFPoints => SDL_GetRectEnclosingPointsF +* SDL_EnclosePoints => SDL_GetRectEnclosingPoints +* SDL_FRectEmpty => SDL_IsRectEmptyF +* SDL_FRectEqualsEpsilon => SDL_AreRectsEqualF +* SDL_HasIntersection => SDL_HasRectIntersection +* SDL_HasIntersectionF => SDL_HasRectIntersectionF +* SDL_IntersectFRect => SDL_GetRectIntersectionF +* SDL_IntersectFRectAndLine => SDL_GetRectAndLineIntersectionF +* SDL_IntersectRect => SDL_GetRectIntersection +* SDL_IntersectRectAndLine => SDL_GetRectAndLineIntersection +* SDL_PointInFRect => SDL_IsPointInRectF +* SDL_PointInRect => SDL_IsPointInRect +* SDL_RectEmpty => SDL_IsRectEmpty +* SDL_RectEquals => SDL_AreRectsEqual +* SDL_UnionFRect => SDL_GetRectUnionF +* SDL_UnionRect => SDL_GetRectUnion + ## SDL_render.h SDL_GetRenderDriverInfo() has been removed, since most of the information it reported were diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index e5ebadfef1..5adc146eff 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -269,6 +269,24 @@ #define __MACOSX__ __MACOS__ #endif +/* ##SDL_rect.h */ +#define SDL_EncloseFPoints SDL_GetRectEnclosingPointsF +#define SDL_EnclosePoints SDL_GetRectEnclosingPoints +#define SDL_FRectEmpty SDL_IsRectEmptyF +#define SDL_FRectEqualsEpsilon SDL_AreRectsEqualF +#define SDL_HasIntersection SDL_HasRectIntersection +#define SDL_HasIntersectionF SDL_HasRectIntersectionF +#define SDL_IntersectFRect SDL_GetRectIntersectionF +#define SDL_IntersectFRectAndLine SDL_GetRectAndLineIntersectionF +#define SDL_IntersectRect SDL_GetRectIntersection +#define SDL_IntersectRectAndLine SDL_GetRectAndLineIntersection +#define SDL_PointInFRect SDL_IsPointInRectF +#define SDL_PointInRect SDL_IsPointInRect +#define SDL_RectEmpty SDL_IsRectEmpty +#define SDL_RectEquals SDL_AreRectsEqual +#define SDL_UnionFRect SDL_GetRectUnionF +#define SDL_UnionRect SDL_GetRectUnion + /* ##SDL_render.h */ #define SDL_RenderCopy SDL_RenderTexture #define SDL_RenderCopyEx SDL_RenderTextureRotated @@ -575,6 +593,24 @@ #define __MACOSX__ __MACOSX___renamed___MACOS__ #endif +/* ##SDL_rect.h */ +#define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsF +#define SDL_EnclosePoints SDL_EnclosePoints_renamed_SDL_GetRectEnclosingPoints +#define SDL_FRectEmpty SDL_FRectEmpty_renamed_SDL_IsRectEmptyF +#define SDL_FRectEqualsEpsilon SDL_FRectEqualsEpsilon_renamed_SDL_AreRectsEqualF +#define SDL_HasIntersection SDL_HasIntersection_renamed_SDL_HasRectIntersection +#define SDL_HasIntersectionF SDL_HasIntersectionF_renamed_SDL_HasRectIntersectionF +#define SDL_IntersectFRect SDL_IntersectFRect_renamed_SDL_GetRectIntersectionF +#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_renamed_SDL_GetRectAndLineIntersectionF +#define SDL_IntersectRect SDL_IntersectRect_renamed_SDL_GetRectIntersection +#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_renamed_SDL_GetRectAndLineIntersection +#define SDL_PointInFRect SDL_PointInFRect_renamed_SDL_IsPointInRectF +#define SDL_PointInRect SDL_PointInRect_renamed_SDL_IsPointInRect +#define SDL_RectEmpty SDL_RectEmpty_renamed_SDL_IsRectEmpty +#define SDL_RectEquals SDL_RectEquals_renamed_SDL_AreRectsEqual +#define SDL_UnionFRect SDL_UnionFRect_renamed_SDL_GetRectUnionF +#define SDL_UnionRect SDL_UnionRect_renamed_SDL_GetRectUnion + /* ##SDL_render.h */ #define SDL_RenderCopy SDL_RenderCopy_renamed_SDL_RenderTexture #define SDL_RenderCopyEx SDL_RenderCopyEx_renamed_SDL_RenderTextureRotated diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index 2a95d1b83b..b66b5dc9ee 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -42,8 +42,8 @@ extern "C" { /** * The structure that defines a point (integer) * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect + * \sa SDL_GetRectEnclosingPoints + * \sa SDL_IsPointInRect */ typedef struct SDL_Point { @@ -54,8 +54,8 @@ typedef struct SDL_Point /** * The structure that defines a point (floating point) * - * \sa SDL_EncloseFPoints - * \sa SDL_PointInFRect + * \sa SDL_GetRectEnclosingPointsF + * \sa SDL_IsPointInRectF */ typedef struct SDL_FPoint { @@ -67,13 +67,13 @@ typedef struct SDL_FPoint /** * A rectangle, with the origin at the upper left (integer). * - * \sa SDL_RectEmpty - * \sa SDL_RectEquals - * \sa SDL_HasIntersection - * \sa SDL_IntersectRect - * \sa SDL_IntersectRectAndLine - * \sa SDL_UnionRect - * \sa SDL_EnclosePoints + * \sa SDL_IsRectEmpty + * \sa SDL_AreRectsEqual + * \sa SDL_HasRectIntersection + * \sa SDL_GetRectIntersection + * \sa SDL_GetRectAndLineIntersection + * \sa SDL_GetRectUnion + * \sa SDL_GetRectEnclosingPoints */ typedef struct SDL_Rect { @@ -85,15 +85,15 @@ typedef struct SDL_Rect /** * A rectangle, with the origin at the upper left (floating point). * - * \sa SDL_FRectEmpty + * \sa SDL_IsRectEmptyF * \sa SDL_FRectEquals - * \sa SDL_FRectEqualsEpsilon - * \sa SDL_HasIntersectionF - * \sa SDL_IntersectFRect - * \sa SDL_IntersectFRectAndLine - * \sa SDL_UnionFRect - * \sa SDL_EncloseFPoints - * \sa SDL_PointInFRect + * \sa SDL_AreRectsEqualF + * \sa SDL_HasRectIntersectionF + * \sa SDL_GetRectIntersectionF + * \sa SDL_GetRectAndLineIntersectionF + * \sa SDL_GetRectUnionF + * \sa SDL_GetRectEnclosingPointsF + * \sa SDL_IsPointInRectF */ typedef struct SDL_FRect { @@ -107,7 +107,7 @@ typedef struct SDL_FRect /** * Returns true if point resides inside a rectangle. */ -SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) +SDL_FORCE_INLINE SDL_bool SDL_IsPointInRect(const SDL_Point *p, const SDL_Rect *r) { return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; @@ -116,7 +116,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) /** * Returns true if the rectangle has no area. */ -SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) +SDL_FORCE_INLINE SDL_bool SDL_IsRectEmpty(const SDL_Rect *r) { return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; } @@ -124,7 +124,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) /** * Returns true if the two rectangles are equal. */ -SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) +SDL_FORCE_INLINE SDL_bool SDL_AreRectsEqual(const SDL_Rect *a, const SDL_Rect *b) { return (a && b && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; @@ -141,9 +141,9 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) * * \since This function is available since SDL 3.0.0. * - * \sa SDL_IntersectRect + * \sa SDL_GetRectIntersection */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, +extern DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect * A, const SDL_Rect * B); /** @@ -159,9 +159,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, * * \since This function is available since SDL 3.0.0. * - * \sa SDL_HasIntersection + * \sa SDL_HasRectIntersection */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); @@ -175,7 +175,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, +extern DECLSPEC void SDLCALL SDL_GetRectUnion(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); @@ -196,7 +196,7 @@ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point * points, int count, const SDL_Rect * clip, SDL_Rect * result); @@ -219,7 +219,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int *Y2); @@ -230,7 +230,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * /** * Returns true if point resides inside a rectangle. */ -SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r) +SDL_FORCE_INLINE SDL_bool SDL_IsPointInRectF(const SDL_FPoint *p, const SDL_FRect *r) { return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; @@ -239,7 +239,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect /** * Returns true if the rectangle has no area. */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) +SDL_FORCE_INLINE SDL_bool SDL_IsRectEmptyF(const SDL_FRect *r) { return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE; } @@ -249,7 +249,7 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) * * \since This function is available since SDL 2.0.22. */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) +SDL_FORCE_INLINE SDL_bool SDL_AreRectsEqualF(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) { return (a && b && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && @@ -266,7 +266,7 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_F */ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b) { - return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON); + return SDL_AreRectsEqualF(a, b, SDL_FLT_EPSILON); } /** @@ -280,9 +280,9 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b * * \since This function is available since SDL 3.0.0. * - * \sa SDL_IntersectRect + * \sa SDL_GetRectIntersection */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A, +extern DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionF(const SDL_FRect * A, const SDL_FRect * B); /** @@ -298,9 +298,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A, * * \since This function is available since SDL 3.0.0. * - * \sa SDL_HasIntersectionF + * \sa SDL_HasRectIntersectionF */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A, +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionF(const SDL_FRect * A, const SDL_FRect * B, SDL_FRect * result); @@ -314,7 +314,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, +extern DECLSPEC void SDLCALL SDL_GetRectUnionF(const SDL_FRect * A, const SDL_FRect * B, SDL_FRect * result); @@ -336,7 +336,7 @@ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsF(const SDL_FPoint * points, int count, const SDL_FRect * clip, SDL_FRect * result); @@ -360,7 +360,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, * * \since This function is available since SDL 3.0.0. */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect * +extern DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionF(const SDL_FRect * rect, float *X1, float *Y1, float *X2, float *Y2); diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 4401a2e8f2..7f58d9cb71 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -395,16 +395,16 @@ SDL3_0.0.0 { SDL_SetYUVConversionMode; SDL_GetYUVConversionMode; SDL_GetYUVConversionModeForResolution; - SDL_HasIntersection; - SDL_IntersectRect; - SDL_UnionRect; - SDL_EnclosePoints; - SDL_IntersectRectAndLine; - SDL_HasIntersectionF; - SDL_IntersectFRect; - SDL_UnionFRect; - SDL_EncloseFPoints; - SDL_IntersectFRectAndLine; + SDL_HasRectIntersection; + SDL_GetRectIntersection; + SDL_GetRectUnion; + SDL_GetRectEnclosingPoints; + SDL_GetRectAndLineIntersection; + SDL_HasRectIntersectionF; + SDL_GetRectIntersectionF; + SDL_GetRectUnionF; + SDL_GetRectEnclosingPointsF; + SDL_GetRectAndLineIntersectionF; SDL_CreateShapedWindow; SDL_IsShapedWindow; SDL_SetWindowShape; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index ea08cb0260..7de7a2fc07 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -277,11 +277,11 @@ #define SDL_GetRGBA SDL_GetRGBA_REAL #define SDL_GetPlatform SDL_GetPlatform_REAL #define SDL_GetPowerInfo SDL_GetPowerInfo_REAL -#define SDL_HasIntersection SDL_HasIntersection_REAL -#define SDL_IntersectRect SDL_IntersectRect_REAL -#define SDL_UnionRect SDL_UnionRect_REAL -#define SDL_EnclosePoints SDL_EnclosePoints_REAL -#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL +#define SDL_HasRectIntersection SDL_HasRectIntersection_REAL +#define SDL_GetRectIntersection SDL_GetRectIntersection_REAL +#define SDL_GetRectUnion SDL_GetRectUnion_REAL +#define SDL_GetRectEnclosingPoints SDL_GetRectEnclosingPoints_REAL +#define SDL_GetRectAndLineIntersection SDL_GetRectAndLineIntersection_REAL #define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL #define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL #define SDL_CreateRenderer SDL_CreateRenderer_REAL @@ -828,11 +828,11 @@ #define SDL_GetTouchName SDL_GetTouchName_REAL #define SDL_ClearComposition SDL_ClearComposition_REAL #define SDL_IsTextInputShown SDL_IsTextInputShown_REAL -#define SDL_HasIntersectionF SDL_HasIntersectionF_REAL -#define SDL_IntersectFRect SDL_IntersectFRect_REAL -#define SDL_UnionFRect SDL_UnionFRect_REAL -#define SDL_EncloseFPoints SDL_EncloseFPoints_REAL -#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL +#define SDL_HasRectIntersectionF SDL_HasRectIntersectionF_REAL +#define SDL_GetRectIntersectionF SDL_GetRectIntersectionF_REAL +#define SDL_GetRectUnionF SDL_GetRectUnionF_REAL +#define SDL_GetRectEnclosingPointsF SDL_GetRectEnclosingPointsF_REAL +#define SDL_GetRectAndLineIntersectionF SDL_GetRectAndLineIntersectionF_REAL #define SDL_GetRenderWindow SDL_GetRenderWindow_REAL #define SDL_bsearch SDL_bsearch_REAL #define SDL_GetGamepadPathForIndex SDL_GetGamepadPathForIndex_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index dcbfd98b55..48bf031fd2 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -304,11 +304,11 @@ SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, U SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return) SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersection,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return) SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return) @@ -895,11 +895,11 @@ SDL_DYNAPI_PROC(int,SDL_AndroidSendMessage,(Uint32 a, int b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetTouchName,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClearComposition,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputShown,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_UnionFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersectionF,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_GetRectUnionF,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPointsF,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersectionF,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPathForIndex,(int a),(a),return) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 1b69179be5..81a70fe4b8 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -567,7 +567,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ window_rect.y = 0; window_rect.w = x_max + 1; window_rect.h = y_max + 1; - if (SDL_IntersectRect(confine, &window_rect, &mouse_rect)) { + if (SDL_GetRectIntersection(confine, &window_rect, &mouse_rect)) { x_min = mouse_rect.x; y_min = mouse_rect.y; x_max = x_min + mouse_rect.w - 1; diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index d9619bda64..9a674b24a9 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -1729,7 +1729,7 @@ int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, real_rect.w = texture->w; real_rect.h = texture->h; if (rect) { - if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { + if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) { return 0; } } @@ -1895,7 +1895,7 @@ int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, real_rect.w = texture->w; real_rect.h = texture->h; if (rect) { - SDL_IntersectRect(rect, &real_rect, &real_rect); + SDL_GetRectIntersection(rect, &real_rect, &real_rect); } if (real_rect.w == 0 || real_rect.h == 0) { @@ -1955,7 +1955,7 @@ int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, real_rect.w = texture->w; real_rect.h = texture->h; if (rect) { - SDL_IntersectRect(rect, &real_rect, &real_rect); + SDL_GetRectIntersection(rect, &real_rect, &real_rect); } if (real_rect.w == 0 || real_rect.h == 0) { @@ -2057,7 +2057,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, real_rect.w = texture->w; real_rect.h = texture->h; if (rect) { - SDL_IntersectRect(rect, &real_rect, &real_rect); + SDL_GetRectIntersection(rect, &real_rect, &real_rect); } ret = SDL_LockTexture(texture, &real_rect, &pixels, &pitch); @@ -3382,14 +3382,14 @@ int SDL_RenderTextureF(SDL_Renderer *renderer, SDL_Texture *texture, real_srcrect.w = texture->w; real_srcrect.h = texture->h; if (srcrect) { - if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) { + if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) { return 0; } } RenderGetViewportSize(renderer, &real_dstrect); if (dstrect) { - if (!SDL_HasIntersectionF(dstrect, &real_dstrect)) { + if (!SDL_HasRectIntersectionF(dstrect, &real_dstrect)) { return 0; } real_dstrect = *dstrect; @@ -3522,7 +3522,7 @@ int SDL_RenderTextureRotatedF(SDL_Renderer *renderer, SDL_Texture *texture, real_srcrect.w = texture->w; real_srcrect.h = texture->h; if (srcrect) { - if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) { + if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) { return 0; } } @@ -4158,7 +4158,7 @@ int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, real_rect.w = (int)SDL_floor(renderer->viewport.w); real_rect.h = (int)SDL_floor(renderer->viewport.h); if (rect) { - if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { + if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) { return 0; } if (real_rect.y > rect->y) { diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 5da255a30f..f09852423d 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1252,7 +1252,7 @@ static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cm METAL_GetOutputSize(renderer, &output.w, &output.h); } - if (SDL_IntersectRect(&output, &clip, &clip)) { + if (SDL_GetRectIntersection(&output, &clip, &clip)) { MTLScissorRect mtlrect; mtlrect.x = clip.x; mtlrect.y = clip.y; diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c index 60a370ec5d..716ca24da5 100644 --- a/src/render/software/SDL_blendfillrect.c +++ b/src/render/software/SDL_blendfillrect.c @@ -223,7 +223,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, /* If 'rect' == NULL, then fill the whole surface */ if (rect) { /* Perform clipping */ - if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) { + if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) { return 0; } rect = &clipped; @@ -335,7 +335,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, for (i = 0; i < count; ++i) { /* Perform clipping */ - if (!SDL_IntersectRect(&rects[i], &dst->clip_rect, &rect)) { + if (!SDL_GetRectIntersection(&rects[i], &dst->clip_rect, &rect)) { continue; } status = func(dst, &rect, blendMode, r, g, b, a); diff --git a/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c index 0114f33b44..e82c57f092 100644 --- a/src/render/software/SDL_blendline.c +++ b/src/render/software/SDL_blendline.c @@ -809,7 +809,7 @@ int SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, /* Perform clipping */ /* FIXME: We don't actually want to clip, as it may change line slope */ - if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) { + if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) { return 0; } @@ -843,7 +843,7 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, /* Perform clipping */ /* FIXME: We don't actually want to clip, as it may change line slope */ - if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) { + if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) { continue; } diff --git a/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c index b543db1d71..c161e25f15 100644 --- a/src/render/software/SDL_drawline.c +++ b/src/render/software/SDL_drawline.c @@ -148,7 +148,7 @@ int SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color) /* Perform clipping */ /* FIXME: We don't actually want to clip, as it may change line slope */ - if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) { + if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) { return 0; } @@ -182,7 +182,7 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, /* Perform clipping */ /* FIXME: We don't actually want to clip, as it may change line slope */ - if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) { + if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) { continue; } diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index b9e648c088..74b984dad5 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -644,7 +644,7 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate) clip_rect.y = cliprect->y + viewport->y; clip_rect.w = cliprect->w; clip_rect.h = cliprect->h; - SDL_IntersectRect(viewport, &clip_rect, &clip_rect); + SDL_GetRectIntersection(viewport, &clip_rect, &clip_rect); SDL_SetSurfaceClipRect(surface, &clip_rect); } else { SDL_SetSurfaceClipRect(surface, drawstate->viewport); diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c index 0aee8d9ad7..32eed85df9 100644 --- a/src/render/software/SDL_triangle.c +++ b/src/render/software/SDL_triangle.c @@ -251,14 +251,14 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin rect.y = 0; rect.w = dst->w; rect.h = dst->h; - SDL_IntersectRect(&dstrect, &rect, &dstrect); + SDL_GetRectIntersection(&dstrect, &rect, &dstrect); } { /* Clip triangle with surface clip rect */ SDL_Rect rect; SDL_GetSurfaceClipRect(dst, &rect); - SDL_IntersectRect(&dstrect, &rect, &dstrect); + SDL_GetRectIntersection(&dstrect, &rect, &dstrect); } if (blend != SDL_BLENDMODE_NONE) { @@ -547,14 +547,14 @@ int SDL_SW_BlitTriangle( rect.w = dst->w; rect.h = dst->h; - SDL_IntersectRect(&dstrect, &rect, &dstrect); + SDL_GetRectIntersection(&dstrect, &rect, &dstrect); } { /* Clip triangle with surface clip rect */ SDL_Rect rect; SDL_GetSurfaceClipRect(dst, &rect); - SDL_IntersectRect(&dstrect, &rect, &dstrect); + SDL_GetRectIntersection(&dstrect, &rect, &dstrect); } /* Set destination pointer */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index cffb19400f..64ccb4b23b 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1303,7 +1303,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state) SDL_ShowWindow(state->windows[i]); - if (!SDL_RectEmpty(&state->confine)) { + if (!SDL_IsRectEmpty(&state->confine)) { SDL_SetWindowMouseRect(state->windows[i], &state->confine); } @@ -1921,7 +1921,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done SDL_Rect clip; SDL_GetWindowSize(state->windows[i], &w, &h); SDL_GetRenderClipRect(state->renderers[i], &clip); - if (SDL_RectEmpty(&clip)) { + if (SDL_IsRectEmpty(&clip)) { clip.x = w / 4; clip.y = h / 4; clip.w = w / 2; diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c index 6d269708a1..ec0720bb98 100644 --- a/src/video/SDL_blit.c +++ b/src/video/SDL_blit.c @@ -59,7 +59,7 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect, } /* Set up source and destination buffer pointers, and BLIT! */ - if (okay && !SDL_RectEmpty(srcrect)) { + if (okay && !SDL_IsRectEmpty(srcrect)) { SDL_BlitFunc RunBlit; SDL_BlitInfo *info = &src->map->info; diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index a96df8218d..8937c94e8f 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -240,7 +240,7 @@ int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) if (rect == NULL) { rect = &dst->clip_rect; /* Don't attempt to fill if the surface's clip_rect is empty */ - if (SDL_RectEmpty(rect)) { + if (SDL_IsRectEmpty(rect)) { return 0; } } @@ -427,7 +427,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, for (i = 0; i < count; ++i) { rect = &rects[i]; /* Perform clipping */ - if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) { + if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) { continue; } rect = &clipped; diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c index 9d0b74de4c..0b204c8109 100644 --- a/src/video/SDL_rect.c +++ b/src/video/SDL_rect.c @@ -90,22 +90,22 @@ SDL_GetSpanEnclosingRect(int width, int height, #define POINTTYPE SDL_Point #define SCALARTYPE int #define COMPUTEOUTCODE ComputeOutCode -#define SDL_HASINTERSECTION SDL_HasIntersection -#define SDL_INTERSECTRECT SDL_IntersectRect -#define SDL_RECTEMPTY SDL_RectEmpty -#define SDL_UNIONRECT SDL_UnionRect -#define SDL_ENCLOSEPOINTS SDL_EnclosePoints -#define SDL_INTERSECTRECTANDLINE SDL_IntersectRectAndLine +#define SDL_HASINTERSECTION SDL_HasRectIntersection +#define SDL_INTERSECTRECT SDL_GetRectIntersection +#define SDL_RECTEMPTY SDL_IsRectEmpty +#define SDL_UNIONRECT SDL_GetRectUnion +#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPoints +#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersection #include "SDL_rect_impl.h" #define RECTTYPE SDL_FRect #define POINTTYPE SDL_FPoint #define SCALARTYPE float #define COMPUTEOUTCODE ComputeOutCodeF -#define SDL_HASINTERSECTION SDL_HasIntersectionF -#define SDL_INTERSECTRECT SDL_IntersectFRect -#define SDL_RECTEMPTY SDL_FRectEmpty -#define SDL_UNIONRECT SDL_UnionFRect -#define SDL_ENCLOSEPOINTS SDL_EncloseFPoints -#define SDL_INTERSECTRECTANDLINE SDL_IntersectFRectAndLine +#define SDL_HASINTERSECTION SDL_HasRectIntersectionF +#define SDL_INTERSECTRECT SDL_GetRectIntersectionF +#define SDL_RECTEMPTY SDL_IsRectEmptyF +#define SDL_UNIONRECT SDL_GetRectUnionF +#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPointsF +#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersectionF #include "SDL_rect_impl.h" diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 13fdd9790d..f98920cdd9 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -607,7 +607,7 @@ SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect) surface->clip_rect = full_rect; return SDL_TRUE; } - return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect); + return SDL_GetRectIntersection(rect, &full_rect, &surface->clip_rect); } void SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect) @@ -896,11 +896,11 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, tmp.y = 0; tmp.w = src->w; tmp.h = src->h; - SDL_IntersectRect(&tmp, &final_src, &final_src); + SDL_GetRectIntersection(&tmp, &final_src, &final_src); } /* Clip again */ - SDL_IntersectRect(&dst->clip_rect, &final_dst, &final_dst); + SDL_GetRectIntersection(&dst->clip_rect, &final_dst, &final_dst); if (dstrect) { *dstrect = final_dst; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index c8cd2175dd..69f434f768 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1108,7 +1108,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h) SDL_GetDisplayBounds(i, &display_rect); /* Check if the window is fully enclosed */ - if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) { + if (SDL_GetRectEnclosingPoints(¢er, 1, &display_rect, NULL)) { return i; } @@ -2900,7 +2900,7 @@ SDL_GetWindowMouseRect(SDL_Window *window) { CHECK_WINDOW_MAGIC(window, NULL); - if (SDL_RectEmpty(&window->mouse_rect)) { + if (SDL_IsRectEmpty(&window->mouse_rect)) { return NULL; } else { return &window->mouse_rect; diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index bc15d7169b..183e37982c 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -236,7 +236,7 @@ static SDL_Window *SDL_FindWindowAtPoint(const int x, const int y) SDL_Window *i; for (i = SDL_GetVideoDevice()->windows; i; i = i->next) { const SDL_Rect r = { i->x, i->y, i->w, i->h }; - if (SDL_PointInRect(&pt, &r)) { + if (SDL_IsPointInRect(&pt, &r)) { return i; } } diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 46b8a2e269..f10dc468ac 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -381,7 +381,7 @@ static SDL_bool AdjustCoordinatesForGrab(SDL_Window *window, int x, int y, CGPoi window_rect.w = window->w; window_rect.h = window->h; - if (SDL_IntersectRect(&window->mouse_rect, &window_rect, &mouse_rect)) { + if (SDL_GetRectIntersection(&window->mouse_rect, &window_rect, &mouse_rect)) { int left = window->x + mouse_rect.x; int right = left + mouse_rect.w - 1; int top = window->y + mouse_rect.y; @@ -428,16 +428,16 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window) window_rect.h = window->h; if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) { - SDL_IntersectRect(&window->mouse_rect, &window_rect, &mouse_rect); + SDL_GetRectIntersection(&window->mouse_rect, &window_rect, &mouse_rect); } if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0 && - SDL_RectEmpty(&mouse_rect)) { + SDL_IsRectEmpty(&mouse_rect)) { SDL_memcpy(&mouse_rect, &window_rect, sizeof(mouse_rect)); } } - if (SDL_RectEmpty(&mouse_rect)) { + if (SDL_IsRectEmpty(&mouse_rect)) { nswindow.mouseConfinementRect = NSZeroRect; } else { NSRect rect; diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 0b175b817c..8a9cdf40f0 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -2758,11 +2758,11 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi } /* Don't confine the pointer if it shouldn't be confined. */ - if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) { + if (SDL_IsRectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) { return 0; } - if (SDL_RectEmpty(&window->mouse_rect)) { + if (SDL_IsRectEmpty(&window->mouse_rect)) { confine_rect = NULL; } else { SDL_Rect scaled_mouse_rect; diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c index 71c3305589..dc05ce50a2 100644 --- a/src/video/wayland/SDL_waylandkeyboard.c +++ b/src/video/wayland/SDL_waylandkeyboard.c @@ -76,7 +76,7 @@ void Wayland_StartTextInput(_THIS) zwp_text_input_v3_set_content_type(input->text_input->text_input, ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE, ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL); - if (!SDL_RectEmpty(rect)) { + if (!SDL_IsRectEmpty(rect)) { /* This gets reset on enable so we have to cache it */ zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, rect->x, @@ -122,7 +122,7 @@ void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect) if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; if (input != NULL && input->text_input) { - if (!SDL_RectEquals(rect, &input->text_input->cursor_rect)) { + if (!SDL_AreRectsEqual(rect, &input->text_input->cursor_rect)) { SDL_copyp(&input->text_input->cursor_rect, rect); zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, rect->x, diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 16855d79bb..5368ef3af4 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -1841,7 +1841,7 @@ void Wayland_SetWindowMouseRect(_THIS, SDL_Window *window) * Just know that this call lets you confine with a rect, SetWindowGrab * lets you confine without a rect. */ - if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) { + if (SDL_IsRectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) { Wayland_input_unconfine_pointer(data->input, window); } else { Wayland_input_confine_pointer(data->input, window); @@ -1854,7 +1854,7 @@ void Wayland_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed) if (grabbed) { Wayland_input_confine_pointer(data->input, window); - } else if (SDL_RectEmpty(&window->mouse_rect)) { + } else if (SDL_IsRectEmpty(&window->mouse_rect)) { Wayland_input_unconfine_pointer(data->input, window); } } diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 5b74bcdb1d..883d298f4d 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -876,7 +876,7 @@ int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *r const long *p = (long *)propdata; const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] }; retval = 0; - if (!SDL_IntersectRect(rect, &usable, rect)) { + if (!SDL_GetRectIntersection(rect, &usable, rect)) { SDL_zerop(rect); } } diff --git a/src/video/x11/SDL_x11xfixes.c b/src/video/x11/SDL_x11xfixes.c index 9fe2c6dc16..8eea5840b2 100644 --- a/src/video/x11/SDL_x11xfixes.c +++ b/src/video/x11/SDL_x11xfixes.c @@ -71,7 +71,7 @@ int X11_XfixesIsInitialized() void X11_SetWindowMouseRect(_THIS, SDL_Window *window) { - if (SDL_RectEmpty(&window->mouse_rect)) { + if (SDL_IsRectEmpty(&window->mouse_rect)) { X11_ConfineCursorWithFlags(_this, window, NULL, 0); } else { if (window->flags & SDL_WINDOW_INPUT_FOCUS) { diff --git a/test/testautomation_rect.c b/test/testautomation_rect.c index 96d6477c6b..9d273b4928 100644 --- a/test/testautomation_rect.c +++ b/test/testautomation_rect.c @@ -10,7 +10,7 @@ /* Helper functions */ /* ! - * \brief Private helper to check SDL_IntersectRectAndLine results + * \brief Private helper to check SDL_GetRectAndLineIntersection results */ void _validateIntersectRectAndLineResults( SDL_bool intersection, SDL_bool expectedIntersection, @@ -37,10 +37,10 @@ void _validateIntersectRectAndLineResults( /* Test case functions */ /* ! - * \brief Tests SDL_IntersectRectAndLine() clipping cases + * \brief Tests SDL_GetRectAndLineIntersection() clipping cases * * \sa - * http://wiki.libsdl.org/SDL_IntersectRectAndLine + * http://wiki.libsdl.org/SDL_GetRectAndLineIntersection */ int rect_testIntersectRectAndLine(void *arg) { @@ -60,7 +60,7 @@ int rect_testIntersectRectAndLine(void *arg) x2 = xRight; y2 = 15; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 15, 31, 15); x1 = 15; @@ -68,7 +68,7 @@ int rect_testIntersectRectAndLine(void *arg) x2 = 15; y2 = yBottom; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 15, 0, 15, 31); x1 = -refRect.w; @@ -76,7 +76,7 @@ int rect_testIntersectRectAndLine(void *arg) x2 = 2 * refRect.w; y2 = 2 * refRect.h; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 0, 31, 31); x1 = 2 * refRect.w; @@ -84,7 +84,7 @@ int rect_testIntersectRectAndLine(void *arg) x2 = -refRect.w; y2 = -refRect.h; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 31, 0, 0); x1 = -1; @@ -92,7 +92,7 @@ int rect_testIntersectRectAndLine(void *arg) x2 = 32; y2 = -1; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 0, 31, 31, 0); x1 = 32; @@ -100,17 +100,17 @@ int rect_testIntersectRectAndLine(void *arg) x2 = -1; y2 = 32; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, 31, 0, 0, 31); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRectAndLine() non-clipping case line inside + * \brief Tests SDL_GetRectAndLineIntersection() non-clipping case line inside * * \sa - * http://wiki.libsdl.org/SDL_IntersectRectAndLine + * http://wiki.libsdl.org/SDL_GetRectAndLineIntersection */ int rect_testIntersectRectAndLineInside(void *arg) { @@ -134,7 +134,7 @@ int rect_testIntersectRectAndLineInside(void *arg) x2 = x2Ref; y2 = y2Ref; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref); x1 = x1Ref; @@ -142,7 +142,7 @@ int rect_testIntersectRectAndLineInside(void *arg) x2 = xmax; y2 = ymax; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, xmax, ymax); x1 = xmin; @@ -150,7 +150,7 @@ int rect_testIntersectRectAndLineInside(void *arg) x2 = x2Ref; y2 = y2Ref; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, x2Ref, y2Ref); x1 = xmin; @@ -158,7 +158,7 @@ int rect_testIntersectRectAndLineInside(void *arg) x2 = xmax; y2 = ymax; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymin, xmax, ymax); x1 = xmin; @@ -166,17 +166,17 @@ int rect_testIntersectRectAndLineInside(void *arg) x2 = xmax; y2 = ymin; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_TRUE, &rect, &refRect, x1, y1, x2, y2, xmin, ymax, xmax, ymin); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRectAndLine() non-clipping cases outside + * \brief Tests SDL_GetRectAndLineIntersection() non-clipping cases outside * * \sa - * http://wiki.libsdl.org/SDL_IntersectRectAndLine + * http://wiki.libsdl.org/SDL_GetRectAndLineIntersection */ int rect_testIntersectRectAndLineOutside(void *arg) { @@ -196,7 +196,7 @@ int rect_testIntersectRectAndLineOutside(void *arg) x2 = xLeft; y2 = 31; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xLeft, 0, xLeft, 31); x1 = xRight; @@ -204,7 +204,7 @@ int rect_testIntersectRectAndLineOutside(void *arg) x2 = xRight; y2 = 31; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, xRight, 0, xRight, 31); x1 = 0; @@ -212,7 +212,7 @@ int rect_testIntersectRectAndLineOutside(void *arg) x2 = 31; y2 = yTop; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yTop, 31, yTop); x1 = 0; @@ -220,17 +220,17 @@ int rect_testIntersectRectAndLineOutside(void *arg) x2 = 31; y2 = yBottom; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, 0, yBottom, 31, yBottom); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRectAndLine() with empty rectangle + * \brief Tests SDL_GetRectAndLineIntersection() with empty rectangle * * \sa - * http://wiki.libsdl.org/SDL_IntersectRectAndLine + * http://wiki.libsdl.org/SDL_GetRectAndLineIntersection */ int rect_testIntersectRectAndLineEmpty(void *arg) { @@ -254,17 +254,17 @@ int rect_testIntersectRectAndLineEmpty(void *arg) x2 = x2Ref; y2 = y2Ref; rect = refRect; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); _validateIntersectRectAndLineResults(intersected, SDL_FALSE, &rect, &refRect, x1, y1, x2, y2, x1Ref, y1Ref, x2Ref, y2Ref); return TEST_COMPLETED; } /* ! - * \brief Negative tests against SDL_IntersectRectAndLine() with invalid parameters + * \brief Negative tests against SDL_GetRectAndLineIntersection() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_IntersectRectAndLine + * http://wiki.libsdl.org/SDL_GetRectAndLineIntersection */ int rect_testIntersectRectAndLineParam(void *arg) { @@ -275,27 +275,27 @@ int rect_testIntersectRectAndLineParam(void *arg) int y2 = 2 * rect.h; SDL_bool intersected; - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, &y2); SDLTest_AssertCheck(intersected == SDL_TRUE, "Check that intersection result was SDL_TRUE"); - intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, &x1, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection((SDL_Rect *)NULL, &x1, &y1, &x2, &y2); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); - intersected = SDL_IntersectRectAndLine(&rect, (int *)NULL, &y1, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, (int *)NULL, &y1, &x2, &y2); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); - intersected = SDL_IntersectRectAndLine(&rect, &x1, (int *)NULL, &x2, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, (int *)NULL, &x2, &y2); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 3rd parameter is NULL"); - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, (int *)NULL, &y2); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, (int *)NULL, &y2); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 4th parameter is NULL"); - intersected = SDL_IntersectRectAndLine(&rect, &x1, &y1, &x2, (int *)NULL); + intersected = SDL_GetRectAndLineIntersection(&rect, &x1, &y1, &x2, (int *)NULL); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when 5th parameter is NULL"); - intersected = SDL_IntersectRectAndLine((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL); + intersected = SDL_GetRectAndLineIntersection((SDL_Rect *)NULL, (int *)NULL, (int *)NULL, (int *)NULL, (int *)NULL); SDLTest_AssertCheck(intersected == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL"); return TEST_COMPLETED; } /* ! - * \brief Private helper to check SDL_HasIntersection results + * \brief Private helper to check SDL_HasRectIntersection results */ void _validateHasIntersectionResults( SDL_bool intersection, SDL_bool expectedIntersection, @@ -318,7 +318,7 @@ void _validateHasIntersectionResults( } /* ! - * \brief Private helper to check SDL_IntersectRect results + * \brief Private helper to check SDL_GetRectIntersection results */ void _validateIntersectRectResults( SDL_bool intersection, SDL_bool expectedIntersection, @@ -337,7 +337,7 @@ void _validateIntersectRectResults( } /* ! - * \brief Private helper to check SDL_UnionRect results + * \brief Private helper to check SDL_GetRectUnion results */ void _validateUnionRectResults( SDL_Rect *rectA, SDL_Rect *rectB, SDL_Rect *refRectA, SDL_Rect *refRectB, @@ -360,7 +360,7 @@ void _validateUnionRectResults( } /* ! - * \brief Private helper to check SDL_RectEmpty results + * \brief Private helper to check SDL_IsRectEmpty results */ void _validateRectEmptyResults( SDL_bool empty, SDL_bool expectedEmpty, @@ -378,7 +378,7 @@ void _validateRectEmptyResults( } /* ! - * \brief Private helper to check SDL_RectEquals results + * \brief Private helper to check SDL_AreRectsEqual results */ void _validateRectEqualsResults( SDL_bool equals, SDL_bool expectedEquals, @@ -427,10 +427,10 @@ void _validateFRectEqualsResults( } /* ! - * \brief Tests SDL_IntersectRect() with B fully inside A + * \brief Tests SDL_GetRectIntersection() with B fully inside A * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectInside(void *arg) { @@ -448,17 +448,17 @@ int rect_testIntersectRectInside(void *arg) refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1); rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRect() with B fully outside A + * \brief Tests SDL_GetRectIntersection() with B fully outside A * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectOutside(void *arg) { @@ -476,17 +476,17 @@ int rect_testIntersectRectOutside(void *arg) refRectB.h = refRectA.h; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRect() with B partially intersecting A + * \brief Tests SDL_GetRectIntersection() with B partially intersecting A * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectPartial(void *arg) { @@ -509,7 +509,7 @@ int rect_testIntersectRectPartial(void *arg) expectedResult.y = refRectB.y; expectedResult.w = refRectA.w - refRectB.x; expectedResult.h = refRectA.h - refRectB.y; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* rectB right edge */ @@ -523,7 +523,7 @@ int rect_testIntersectRectPartial(void *arg) expectedResult.y = refRectB.y; expectedResult.w = 1; expectedResult.h = refRectB.h; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* rectB left edge */ @@ -537,7 +537,7 @@ int rect_testIntersectRectPartial(void *arg) expectedResult.y = refRectB.y; expectedResult.w = 1; expectedResult.h = refRectB.h; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* rectB bottom edge */ @@ -551,7 +551,7 @@ int rect_testIntersectRectPartial(void *arg) expectedResult.y = refRectB.y; expectedResult.w = refRectB.w; expectedResult.h = 1; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* rectB top edge */ @@ -565,17 +565,17 @@ int rect_testIntersectRectPartial(void *arg) expectedResult.y = 0; expectedResult.w = refRectB.w; expectedResult.h = 1; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_IntersectRect() with 1x1 pixel sized rectangles + * \brief Tests SDL_GetRectIntersection() with 1x1 pixel sized rectangles * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectPoint(void *arg) { @@ -594,7 +594,7 @@ int rect_testIntersectRectPoint(void *arg) refRectB.y = refRectA.y; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA); /* non-intersecting pixels cases */ @@ -609,7 +609,7 @@ int rect_testIntersectRectPoint(void *arg) refRectB.y += offsetY; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL); } } @@ -619,10 +619,10 @@ int rect_testIntersectRectPoint(void *arg) } /* ! - * \brief Tests SDL_IntersectRect() with empty rectangles + * \brief Tests SDL_GetRectIntersection() with empty rectangles * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectEmpty(void *arg) { @@ -646,9 +646,9 @@ int rect_testIntersectRectEmpty(void *arg) refRectA.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL); - empty = SDL_RectEmpty(&result); + empty = SDL_IsRectEmpty(&result); SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE"); /* Rect B empty */ @@ -663,9 +663,9 @@ int rect_testIntersectRectEmpty(void *arg) refRectB.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL); - empty = SDL_RectEmpty(&result); + empty = SDL_IsRectEmpty(&result); SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE"); /* Rect A and B empty */ @@ -682,19 +682,19 @@ int rect_testIntersectRectEmpty(void *arg) refRectB.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_IntersectRect(&rectA, &rectB, &result); + intersection = SDL_GetRectIntersection(&rectA, &rectB, &result); _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL); - empty = SDL_RectEmpty(&result); + empty = SDL_IsRectEmpty(&result); SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE"); return TEST_COMPLETED; } /* ! - * \brief Negative tests against SDL_IntersectRect() with invalid parameters + * \brief Negative tests against SDL_GetRectIntersection() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_IntersectRect + * http://wiki.libsdl.org/SDL_GetRectIntersection */ int rect_testIntersectRectParam(void *arg) { @@ -704,27 +704,27 @@ int rect_testIntersectRectParam(void *arg) SDL_bool intersection; /* invalid parameter combinations */ - intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result); + intersection = SDL_GetRectIntersection((SDL_Rect *)NULL, &rectB, &result); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); - intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result); + intersection = SDL_GetRectIntersection(&rectA, (SDL_Rect *)NULL, &result); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); - intersection = SDL_IntersectRect(&rectA, &rectB, (SDL_Rect *)NULL); + intersection = SDL_GetRectIntersection(&rectA, &rectB, (SDL_Rect *)NULL); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 3st parameter is NULL"); - intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result); + intersection = SDL_GetRectIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL, &result); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameters are NULL"); - intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL); + intersection = SDL_GetRectIntersection((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 3rd parameters are NULL "); - intersection = SDL_IntersectRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL); + intersection = SDL_GetRectIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL"); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_HasIntersection() with B fully inside A + * \brief Tests SDL_HasRectIntersection() with B fully inside A * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionInside(void *arg) { @@ -741,17 +741,17 @@ int rect_testHasIntersectionInside(void *arg) refRectB.h = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1); rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_HasIntersection() with B fully outside A + * \brief Tests SDL_HasRectIntersection() with B fully outside A * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionOutside(void *arg) { @@ -768,17 +768,17 @@ int rect_testHasIntersectionOutside(void *arg) refRectB.h = refRectA.h; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_HasIntersection() with B partially intersecting A + * \brief Tests SDL_HasRectIntersection() with B partially intersecting A * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionPartial(void *arg) { @@ -795,7 +795,7 @@ int rect_testHasIntersectionPartial(void *arg) refRectB.h = refRectA.h; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); /* rectB right edge */ @@ -805,7 +805,7 @@ int rect_testHasIntersectionPartial(void *arg) refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1); rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); /* rectB left edge */ @@ -815,7 +815,7 @@ int rect_testHasIntersectionPartial(void *arg) refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1); rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); /* rectB bottom edge */ @@ -825,7 +825,7 @@ int rect_testHasIntersectionPartial(void *arg) refRectB.h = SDLTest_RandomIntegerInRange(1, refRectA.h - 1); rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); /* rectB top edge */ @@ -835,17 +835,17 @@ int rect_testHasIntersectionPartial(void *arg) refRectB.h = rectA.h; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_HasIntersection() with 1x1 pixel sized rectangles + * \brief Tests SDL_HasRectIntersection() with 1x1 pixel sized rectangles * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionPoint(void *arg) { @@ -863,7 +863,7 @@ int rect_testHasIntersectionPoint(void *arg) refRectB.y = refRectA.y; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB); /* non-intersecting pixels cases */ @@ -878,7 +878,7 @@ int rect_testHasIntersectionPoint(void *arg) refRectB.y += offsetY; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); } } @@ -888,10 +888,10 @@ int rect_testHasIntersectionPoint(void *arg) } /* ! - * \brief Tests SDL_HasIntersection() with empty rectangles + * \brief Tests SDL_HasRectIntersection() with empty rectangles * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionEmpty(void *arg) { @@ -911,7 +911,7 @@ int rect_testHasIntersectionEmpty(void *arg) refRectA.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); /* Rect B empty */ @@ -924,7 +924,7 @@ int rect_testHasIntersectionEmpty(void *arg) refRectB.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); /* Rect A and B empty */ @@ -939,17 +939,17 @@ int rect_testHasIntersectionEmpty(void *arg) refRectB.h = 0; rectA = refRectA; rectB = refRectB; - intersection = SDL_HasIntersection(&rectA, &rectB); + intersection = SDL_HasRectIntersection(&rectA, &rectB); _validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Negative tests against SDL_HasIntersection() with invalid parameters + * \brief Negative tests against SDL_HasRectIntersection() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_HasIntersection + * http://wiki.libsdl.org/SDL_HasRectIntersection */ int rect_testHasIntersectionParam(void *arg) { @@ -958,21 +958,21 @@ int rect_testHasIntersectionParam(void *arg) SDL_bool intersection; /* invalid parameter combinations */ - intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB); + intersection = SDL_HasRectIntersection((SDL_Rect *)NULL, &rectB); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); - intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL); + intersection = SDL_HasRectIntersection(&rectA, (SDL_Rect *)NULL); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 2st parameter is NULL"); - intersection = SDL_HasIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL); + intersection = SDL_HasRectIntersection((SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when all parameters are NULL"); return TEST_COMPLETED; } /* ! - * \brief Test SDL_EnclosePoints() without clipping + * \brief Test SDL_GetRectEnclosingPoints() without clipping * * \sa - * http://wiki.libsdl.org/SDL_EnclosePoints + * http://wiki.libsdl.org/SDL_GetRectEnclosingPoints */ int rect_testEnclosePoints(void *arg) { @@ -1017,7 +1017,7 @@ int rect_testEnclosePoints(void *arg) } /* Call function and validate - special case: no result requested */ - anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL); + anyEnclosedNoResult = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertCheck(expectedEnclosed == anyEnclosedNoResult, "Check expected return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1029,7 +1029,7 @@ int rect_testEnclosePoints(void *arg) } /* Call function and validate */ - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result); SDLTest_AssertCheck(expectedEnclosed == anyEnclosed, "Check return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1047,10 +1047,10 @@ int rect_testEnclosePoints(void *arg) } /* ! - * \brief Test SDL_EnclosePoints() with repeated input points + * \brief Test SDL_GetRectEnclosingPoints() with repeated input points * * \sa - * http://wiki.libsdl.org/SDL_EnclosePoints + * http://wiki.libsdl.org/SDL_GetRectEnclosingPoints */ int rect_testEnclosePointsRepeatedInput(void *arg) { @@ -1101,7 +1101,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg) } /* Call function and validate - special case: no result requested */ - anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL); + anyEnclosedNoResult = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertCheck(expectedEnclosed == anyEnclosedNoResult, "Check return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1113,7 +1113,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg) } /* Call function and validate */ - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result); SDLTest_AssertCheck(expectedEnclosed == anyEnclosed, "Check return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1131,10 +1131,10 @@ int rect_testEnclosePointsRepeatedInput(void *arg) } /* ! - * \brief Test SDL_EnclosePoints() with clipping + * \brief Test SDL_GetRectEnclosingPoints() with clipping * * \sa - * http://wiki.libsdl.org/SDL_EnclosePoints + * http://wiki.libsdl.org/SDL_GetRectEnclosingPoints */ int rect_testEnclosePointsWithClipping(void *arg) { @@ -1192,7 +1192,7 @@ int rect_testEnclosePointsWithClipping(void *arg) /* Call function and validate - special case: no result requested */ clip = refClip; - anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL); + anyEnclosedNoResult = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL); SDLTest_AssertCheck(expectedEnclosed == anyEnclosedNoResult, "Expected return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1206,7 +1206,7 @@ int rect_testEnclosePointsWithClipping(void *arg) "Check that source clipping rectangle was not modified"); /* Call function and validate */ - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(expectedEnclosed == anyEnclosed, "Check return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1228,7 +1228,7 @@ int rect_testEnclosePointsWithClipping(void *arg) clip.w = 0; clip.h = 0; expectedEnclosed = SDL_FALSE; - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(expectedEnclosed == anyEnclosed, "Check return value %s, got %s", (expectedEnclosed == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", @@ -1238,10 +1238,10 @@ int rect_testEnclosePointsWithClipping(void *arg) } /* ! - * \brief Negative tests against SDL_EnclosePoints() with invalid parameters + * \brief Negative tests against SDL_GetRectEnclosingPoints() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_EnclosePoints + * http://wiki.libsdl.org/SDL_GetRectEnclosingPoints */ int rect_testEnclosePointsParam(void *arg) { @@ -1252,24 +1252,24 @@ int rect_testEnclosePointsParam(void *arg) SDL_bool anyEnclosed; /* invalid parameter combinations */ - anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL"); - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is 0"); count = SDLTest_RandomIntegerInRange(-100, -1); - anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((const SDL_Point *)points, count, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 2nd parameter is %i (negative)", count); - anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result); + anyEnclosed = SDL_GetRectEnclosingPoints((SDL_Point *)NULL, 0, (const SDL_Rect *)&clip, &result); SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL and 2nd parameter was 0"); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_UnionRect() where rect B is outside rect A + * \brief Tests SDL_GetRectUnion() where rect B is outside rect A * * \sa - * http://wiki.libsdl.org/SDL_UnionRect + * http://wiki.libsdl.org/SDL_GetRectUnion */ int rect_testUnionRectOutside(void *arg) { @@ -1302,7 +1302,7 @@ int rect_testUnionRectOutside(void *arg) expectedResult.h = maxy - miny + 1; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); } } @@ -1335,7 +1335,7 @@ int rect_testUnionRectOutside(void *arg) } rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); } } @@ -1345,10 +1345,10 @@ int rect_testUnionRectOutside(void *arg) } /* ! - * \brief Tests SDL_UnionRect() where rect A or rect B are empty + * \brief Tests SDL_GetRectUnion() where rect A or rect B are empty * * \sa - * http://wiki.libsdl.org/SDL_UnionRect + * http://wiki.libsdl.org/SDL_GetRectUnion */ int rect_testUnionRectEmpty(void *arg) { @@ -1369,7 +1369,7 @@ int rect_testUnionRectEmpty(void *arg) expectedResult = refRectB; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* B empty */ @@ -1384,7 +1384,7 @@ int rect_testUnionRectEmpty(void *arg) expectedResult = refRectA; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* A and B empty */ @@ -1403,17 +1403,17 @@ int rect_testUnionRectEmpty(void *arg) expectedResult = result; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_UnionRect() where rect B is inside rect A + * \brief Tests SDL_GetRectUnion() where rect B is inside rect A * * \sa - * http://wiki.libsdl.org/SDL_UnionRect + * http://wiki.libsdl.org/SDL_GetRectUnion */ int rect_testUnionRectInside(void *arg) { @@ -1430,7 +1430,7 @@ int rect_testUnionRectInside(void *arg) refRectA.h = 1; expectedResult = refRectA; rectA = refRectA; - SDL_UnionRect(&rectA, &rectA, &result); + SDL_GetRectUnion(&rectA, &rectA, &result); _validateUnionRectResults(&rectA, &rectA, &refRectA, &refRectA, &result, &expectedResult); /* Union 1x1 somewhere inside */ @@ -1445,7 +1445,7 @@ int rect_testUnionRectInside(void *arg) expectedResult = refRectA; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); /* Union inside with edges modified */ @@ -1472,7 +1472,7 @@ int rect_testUnionRectInside(void *arg) expectedResult = refRectA; rectA = refRectA; rectB = refRectB; - SDL_UnionRect(&rectA, &rectB, &result); + SDL_GetRectUnion(&rectA, &rectB, &result); _validateUnionRectResults(&rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult); } } @@ -1482,10 +1482,10 @@ int rect_testUnionRectInside(void *arg) } /* ! - * \brief Negative tests against SDL_UnionRect() with invalid parameters + * \brief Negative tests against SDL_GetRectUnion() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_UnionRect + * http://wiki.libsdl.org/SDL_GetRectUnion */ int rect_testUnionRectParam(void *arg) { @@ -1493,27 +1493,27 @@ int rect_testUnionRectParam(void *arg) SDL_Rect result; /* invalid parameter combinations */ - SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result); + SDL_GetRectUnion((SDL_Rect *)NULL, &rectB, &result); SDLTest_AssertPass("Check that function returns when 1st parameter is NULL"); - SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result); + SDL_GetRectUnion(&rectA, (SDL_Rect *)NULL, &result); SDLTest_AssertPass("Check that function returns when 2nd parameter is NULL"); - SDL_UnionRect(&rectA, &rectB, (SDL_Rect *)NULL); + SDL_GetRectUnion(&rectA, &rectB, (SDL_Rect *)NULL); SDLTest_AssertPass("Check that function returns when 3rd parameter is NULL"); - SDL_UnionRect((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL); + SDL_GetRectUnion((SDL_Rect *)NULL, &rectB, (SDL_Rect *)NULL); SDLTest_AssertPass("Check that function returns when 1st and 3rd parameter are NULL"); - SDL_UnionRect(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL); + SDL_GetRectUnion(&rectA, (SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertPass("Check that function returns when 2nd and 3rd parameter are NULL"); - SDL_UnionRect((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL); + SDL_GetRectUnion((SDL_Rect *)NULL, (SDL_Rect *)NULL, (SDL_Rect *)NULL); SDLTest_AssertPass("Check that function returns when all parameters are NULL"); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_RectEmpty() with various inputs + * \brief Tests SDL_IsRectEmpty() with various inputs * * \sa - * http://wiki.libsdl.org/SDL_RectEmpty + * http://wiki.libsdl.org/SDL_IsRectEmpty */ int rect_testRectEmpty(void *arg) { @@ -1530,7 +1530,7 @@ int rect_testRectEmpty(void *arg) refRect.h = SDLTest_RandomIntegerInRange(256, 1024); expectedResult = SDL_FALSE; rect = refRect; - result = SDL_RectEmpty(&rect); + result = SDL_IsRectEmpty(&rect); _validateRectEmptyResults(result, expectedResult, &rect, &refRect); /* Empty case */ @@ -1543,7 +1543,7 @@ int rect_testRectEmpty(void *arg) refRect.h = h; expectedResult = SDL_TRUE; rect = refRect; - result = SDL_RectEmpty(&rect); + result = SDL_IsRectEmpty(&rect); _validateRectEmptyResults(result, expectedResult, &rect, &refRect); } } @@ -1553,27 +1553,27 @@ int rect_testRectEmpty(void *arg) } /* ! - * \brief Negative tests against SDL_RectEmpty() with invalid parameters + * \brief Negative tests against SDL_IsRectEmpty() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_RectEmpty + * http://wiki.libsdl.org/SDL_IsRectEmpty */ int rect_testRectEmptyParam(void *arg) { SDL_bool result; /* invalid parameter combinations */ - result = SDL_RectEmpty(NULL); + result = SDL_IsRectEmpty(NULL); SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL"); return TEST_COMPLETED; } /* ! - * \brief Tests SDL_RectEquals() with various inputs + * \brief Tests SDL_AreRectsEqual() with various inputs * * \sa - * http://wiki.libsdl.org/SDL_RectEquals + * http://wiki.libsdl.org/SDL_AreRectsEqual */ int rect_testRectEquals(void *arg) { @@ -1593,17 +1593,17 @@ int rect_testRectEquals(void *arg) expectedResult = SDL_TRUE; rectA = refRectA; rectB = refRectB; - result = SDL_RectEquals(&rectA, &rectB); + result = SDL_AreRectsEqual(&rectA, &rectB); _validateRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB); return TEST_COMPLETED; } /* ! - * \brief Negative tests against SDL_RectEquals() with invalid parameters + * \brief Negative tests against SDL_AreRectsEqual() with invalid parameters * * \sa - * http://wiki.libsdl.org/SDL_RectEquals + * http://wiki.libsdl.org/SDL_AreRectsEqual */ int rect_testRectEqualsParam(void *arg) { @@ -1622,11 +1622,11 @@ int rect_testRectEqualsParam(void *arg) rectB.h = SDLTest_RandomIntegerInRange(1, 1024); /* invalid parameter combinations */ - result = SDL_RectEquals(NULL, &rectB); + result = SDL_AreRectsEqual(NULL, &rectB); SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); - result = SDL_RectEquals(&rectA, NULL); + result = SDL_AreRectsEqual(&rectA, NULL); SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); - result = SDL_RectEquals(NULL, NULL); + result = SDL_AreRectsEqual(NULL, NULL); SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL"); return TEST_COMPLETED; @@ -1699,128 +1699,128 @@ int rect_testFRectEqualsParam(void *arg) /* Rect test cases */ -/* SDL_IntersectRectAndLine */ +/* SDL_GetRectAndLineIntersection */ static const SDLTest_TestCaseReference rectTest1 = { - (SDLTest_TestCaseFp)rect_testIntersectRectAndLine, "rect_testIntersectRectAndLine", "Tests SDL_IntersectRectAndLine clipping cases", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectAndLine, "rect_testIntersectRectAndLine", "Tests SDL_GetRectAndLineIntersection clipping cases", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest2 = { - (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_IntersectRectAndLine with line fully contained in rect", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectAndLineInside, "rect_testIntersectRectAndLineInside", "Tests SDL_GetRectAndLineIntersection with line fully contained in rect", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest3 = { - (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_IntersectRectAndLine with line fully outside of rect", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectAndLineOutside, "rect_testIntersectRectAndLineOutside", "Tests SDL_GetRectAndLineIntersection with line fully outside of rect", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest4 = { - (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_IntersectRectAndLine with empty rectangle ", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectAndLineEmpty, "rect_testIntersectRectAndLineEmpty", "Tests SDL_GetRectAndLineIntersection with empty rectangle ", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest5 = { - (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_IntersectRectAndLine with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectAndLineParam, "rect_testIntersectRectAndLineParam", "Negative tests against SDL_GetRectAndLineIntersection with invalid parameters", TEST_ENABLED }; -/* SDL_IntersectRect */ +/* SDL_GetRectIntersection */ static const SDLTest_TestCaseReference rectTest6 = { - (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_IntersectRect with B fully contained in A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectInside, "rect_testIntersectRectInside", "Tests SDL_GetRectIntersection with B fully contained in A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest7 = { - (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_IntersectRect with B fully outside of A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectOutside, "rect_testIntersectRectOutside", "Tests SDL_GetRectIntersection with B fully outside of A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest8 = { - (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_IntersectRect with B partially intersecting A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectPartial, "rect_testIntersectRectPartial", "Tests SDL_GetRectIntersection with B partially intersecting A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest9 = { - (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_IntersectRect with 1x1 sized rectangles", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectPoint, "rect_testIntersectRectPoint", "Tests SDL_GetRectIntersection with 1x1 sized rectangles", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest10 = { - (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_IntersectRect with empty rectangles", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectEmpty, "rect_testIntersectRectEmpty", "Tests SDL_GetRectIntersection with empty rectangles", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest11 = { - (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_IntersectRect with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testIntersectRectParam, "rect_testIntersectRectParam", "Negative tests against SDL_GetRectIntersection with invalid parameters", TEST_ENABLED }; -/* SDL_HasIntersection */ +/* SDL_HasRectIntersection */ static const SDLTest_TestCaseReference rectTest12 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasIntersection with B fully contained in A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionInside, "rect_testHasIntersectionInside", "Tests SDL_HasRectIntersection with B fully contained in A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest13 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasIntersection with B fully outside of A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionOutside, "rect_testHasIntersectionOutside", "Tests SDL_HasRectIntersection with B fully outside of A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest14 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionPartial, "rect_testHasIntersectionPartial", "Tests SDL_HasIntersection with B partially intersecting A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionPartial, "rect_testHasIntersectionPartial", "Tests SDL_HasRectIntersection with B partially intersecting A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest15 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasIntersection with 1x1 sized rectangles", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionPoint, "rect_testHasIntersectionPoint", "Tests SDL_HasRectIntersection with 1x1 sized rectangles", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest16 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasIntersection with empty rectangles", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionEmpty, "rect_testHasIntersectionEmpty", "Tests SDL_HasRectIntersection with empty rectangles", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest17 = { - (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasIntersection with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testHasIntersectionParam, "rect_testHasIntersectionParam", "Negative tests against SDL_HasRectIntersection with invalid parameters", TEST_ENABLED }; -/* SDL_EnclosePoints */ +/* SDL_GetRectEnclosingPoints */ static const SDLTest_TestCaseReference rectTest18 = { - (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_EnclosePoints without clipping", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testEnclosePoints, "rect_testEnclosePoints", "Tests SDL_GetRectEnclosingPoints without clipping", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest19 = { - (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_EnclosePoints with clipping", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testEnclosePointsWithClipping, "rect_testEnclosePointsWithClipping", "Tests SDL_GetRectEnclosingPoints with clipping", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest20 = { - (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_EnclosePoints with repeated input", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testEnclosePointsRepeatedInput, "rect_testEnclosePointsRepeatedInput", "Tests SDL_GetRectEnclosingPoints with repeated input", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest21 = { - (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_EnclosePoints with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testEnclosePointsParam, "rect_testEnclosePointsParam", "Negative tests against SDL_GetRectEnclosingPoints with invalid parameters", TEST_ENABLED }; -/* SDL_UnionRect */ +/* SDL_GetRectUnion */ static const SDLTest_TestCaseReference rectTest22 = { - (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_UnionRect where rect B is inside rect A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testUnionRectInside, "rect_testUnionRectInside", "Tests SDL_GetRectUnion where rect B is inside rect A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest23 = { - (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_UnionRect where rect B is outside rect A", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testUnionRectOutside, "rect_testUnionRectOutside", "Tests SDL_GetRectUnion where rect B is outside rect A", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest24 = { - (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_UnionRect where rect A or rect B are empty", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testUnionRectEmpty, "rect_testUnionRectEmpty", "Tests SDL_GetRectUnion where rect A or rect B are empty", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest25 = { - (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_UnionRect with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testUnionRectParam, "rect_testUnionRectParam", "Negative tests against SDL_GetRectUnion with invalid parameters", TEST_ENABLED }; -/* SDL_RectEmpty */ +/* SDL_IsRectEmpty */ static const SDLTest_TestCaseReference rectTest26 = { - (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_RectEmpty with various inputs", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testRectEmpty, "rect_testRectEmpty", "Tests SDL_IsRectEmpty with various inputs", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest27 = { - (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_RectEmpty with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testRectEmptyParam, "rect_testRectEmptyParam", "Negative tests against SDL_IsRectEmpty with invalid parameters", TEST_ENABLED }; -/* SDL_RectEquals */ +/* SDL_AreRectsEqual */ static const SDLTest_TestCaseReference rectTest28 = { - (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_RectEquals with various inputs", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testRectEquals, "rect_testRectEquals", "Tests SDL_AreRectsEqual with various inputs", TEST_ENABLED }; static const SDLTest_TestCaseReference rectTest29 = { - (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED + (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_AreRectsEqual with invalid parameters", TEST_ENABLED }; /* SDL_FRectEquals */ diff --git a/test/testgamepad.c b/test/testgamepad.c index 39045e99ea..b4ee969593 100644 --- a/test/testgamepad.c +++ b/test/testgamepad.c @@ -443,7 +443,7 @@ static SDL_GamepadButton FindButtonAtPosition(int x, int y) rect.y = button_positions[i].y; rect.w = BUTTON_SIZE; rect.h = BUTTON_SIZE; - if (SDL_PointInRect(&point, &rect)) { + if (SDL_IsPointInRect(&point, &rect)) { return (SDL_GamepadButton)i; } } @@ -466,7 +466,7 @@ static SDL_GamepadAxis FindAxisAtPosition(int x, int y) rect.y = axis_positions[i].y; rect.w = AXIS_SIZE; rect.h = AXIS_SIZE; - if (SDL_PointInRect(&point, &rect)) { + if (SDL_IsPointInRect(&point, &rect)) { return (SDL_GamepadAxis)i; } } diff --git a/test/testhittesting.c b/test/testhittesting.c index 337205144f..33a53920fc 100644 --- a/test/testhittesting.c +++ b/test/testhittesting.c @@ -32,7 +32,7 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data) int w, h; for (i = 0; i < numareas; i++) { - if (SDL_PointInRect(pt, &areas[i])) { + if (SDL_IsPointInRect(pt, &areas[i])) { SDL_Log("HIT-TEST: DRAGGABLE\n"); return SDL_HITTEST_DRAGGABLE; } diff --git a/test/testintersections.c b/test/testintersections.c index 8688765d76..427e563ef9 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -184,7 +184,7 @@ DrawRectLineIntersections(SDL_Renderer *renderer) x2 = lines[j].w; y2 = lines[j].h; - if (SDL_IntersectRectAndLine(&r, &x1, &y1, &x2, &y2)) { + if (SDL_GetRectAndLineIntersection(&r, &x1, &y1, &x2, &y2)) { SDL_RenderLine(renderer, x1, y1, x2, y2); } } @@ -201,7 +201,7 @@ DrawRectRectIntersections(SDL_Renderer *renderer) for (i = 0; i < num_rects; i++) { for (j = i + 1; j < num_rects; j++) { SDL_Rect r; - if (SDL_IntersectRect(&rects[i], &rects[j], &r)) { + if (SDL_GetRectIntersection(&rects[i], &rects[j], &r)) { SDL_RenderFillRect(renderer, &r); } } diff --git a/test/testwm2.c b/test/testwm2.c index a0289341ea..1b5da0bfce 100644 --- a/test/testwm2.c +++ b/test/testwm2.c @@ -120,7 +120,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_Rect viewport) cell_rect.w = text_length * FONT_CHARACTER_SIZE; cell_rect.h = lineHeight; - if (SDL_PointInRect(&mouse_pos, &cell_rect)) { + if (SDL_IsPointInRect(&mouse_pos, &cell_rect)) { SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); /* Update cached mode under the mouse */