Switch uses of MIN() to SDL_min()

We're excluding files in src/hidapi to minimize the
diff against the upstream project.
main
Eddy Jansson 2022-04-29 19:30:47 +02:00 committed by Sam Lantinga
parent ca26df3404
commit 6c2928b4be
4 changed files with 7 additions and 20 deletions

View File

@ -61,11 +61,6 @@ typedef struct tColorY {
Uint8 y; Uint8 y;
} tColorY; } tColorY;
/* !
\brief Returns maximum of two numbers a and b.
*/
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/* ! /* !
\brief Number of guard rows added to destination surfaces. \brief Number of guard rows added to destination surfaces.

View File

@ -22,10 +22,6 @@
#ifndef SDL_rotate_h_ #ifndef SDL_rotate_h_
#define SDL_rotate_h_ #define SDL_rotate_h_
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy, extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy,
const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center); const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center);
extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center, extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center,

View File

@ -92,10 +92,6 @@
#include "SDL_blit.h" #include "SDL_blit.h"
#include "SDL_RLEaccel_c.h" #include "SDL_RLEaccel_c.h"
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#define PIXEL_COPY(to, from, len, bpp) \ #define PIXEL_COPY(to, from, len, bpp) \
SDL_memcpy(to, from, (size_t)(len) * (bpp)) SDL_memcpy(to, from, (size_t)(len) * (bpp))
@ -1161,13 +1157,13 @@ RLEAlphaSurface(SDL_Surface * surface)
ADD_OPAQUE_COUNTS(max_opaque_run, 0); ADD_OPAQUE_COUNTS(max_opaque_run, 0);
skip -= max_opaque_run; skip -= max_opaque_run;
} }
len = MIN(run, max_opaque_run); len = SDL_min(run, max_opaque_run);
ADD_OPAQUE_COUNTS(skip, len); ADD_OPAQUE_COUNTS(skip, len);
dst += copy_opaque(dst, src + runstart, len, sf, df); dst += copy_opaque(dst, src + runstart, len, sf, df);
runstart += len; runstart += len;
run -= len; run -= len;
while (run) { while (run) {
len = MIN(run, max_opaque_run); len = SDL_min(run, max_opaque_run);
ADD_OPAQUE_COUNTS(0, len); ADD_OPAQUE_COUNTS(0, len);
dst += copy_opaque(dst, src + runstart, len, sf, df); dst += copy_opaque(dst, src + runstart, len, sf, df);
runstart += len; runstart += len;
@ -1195,13 +1191,13 @@ RLEAlphaSurface(SDL_Surface * surface)
ADD_TRANSL_COUNTS(max_transl_run, 0); ADD_TRANSL_COUNTS(max_transl_run, 0);
skip -= max_transl_run; skip -= max_transl_run;
} }
len = MIN(run, max_transl_run); len = SDL_min(run, max_transl_run);
ADD_TRANSL_COUNTS(skip, len); ADD_TRANSL_COUNTS(skip, len);
dst += copy_transl(dst, src + runstart, len, sf, df); dst += copy_transl(dst, src + runstart, len, sf, df);
runstart += len; runstart += len;
run -= len; run -= len;
while (run) { while (run) {
len = MIN(run, max_transl_run); len = SDL_min(run, max_transl_run);
ADD_TRANSL_COUNTS(0, len); ADD_TRANSL_COUNTS(0, len);
dst += copy_transl(dst, src + runstart, len, sf, df); dst += copy_transl(dst, src + runstart, len, sf, df);
runstart += len; runstart += len;
@ -1359,14 +1355,14 @@ RLEColorkeySurface(SDL_Surface * surface)
ADD_COUNTS(maxn, 0); ADD_COUNTS(maxn, 0);
skip -= maxn; skip -= maxn;
} }
len = MIN(run, maxn); len = SDL_min(run, maxn);
ADD_COUNTS(skip, len); ADD_COUNTS(skip, len);
SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
dst += len * bpp; dst += len * bpp;
run -= len; run -= len;
runstart += len; runstart += len;
while (run) { while (run) {
len = MIN(run, maxn); len = SDL_min(run, maxn);
ADD_COUNTS(0, len); ADD_COUNTS(0, len);
SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
dst += len * bpp; dst += len * bpp;

View File

@ -89,7 +89,7 @@
glGetIntegerv(GL_MAX_SAMPLES, &maxsamples); glGetIntegerv(GL_MAX_SAMPLES, &maxsamples);
/* Clamp the samples to the max supported count. */ /* Clamp the samples to the max supported count. */
samples = MIN(samples, maxsamples); samples = SDL_min(samples, maxsamples);
} }
if (sRGB) { if (sRGB) {