gd_intern: unify the min/max/clamp macros some more

master
Mike Frysinger 2021-02-05 22:47:13 -05:00
parent f538eedc7c
commit e1f02d2833
7 changed files with 5 additions and 26 deletions

View File

@ -499,12 +499,6 @@ BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, i
#define HWB_UNDEFINED -1
#define SETUP_RGB(s, r, g, b) {s.R = r/255.0; s.G = g/255.0; s.B = b/255.0;}
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c)))
#define MAX(a,b) ((a)<(b)?(b):(a))
#define MAX3(a,b,c) ((a)<(b)?(MAX(b,c)):(MAX(a,c)))
/*
* Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure
* red always maps to 6 in this implementation. Therefore UNDEFINED can be

View File

@ -30,8 +30,6 @@
typedef int (BGD_STDCALL *FuncPtr)(gdImagePtr, int, int);
#define GET_PIXEL_FUNCTION(src)(src->trueColor?gdImageGetTrueColorPixel:gdImageGetPixel)
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)<(b)?(b):(a))
#ifdef _WIN32
# define GD_SCATTER_SEED() (unsigned int)(time(0) * GetCurrentProcessId())

View File

@ -1,3 +1,5 @@
/* Internal header for random common utility functions. */
#ifndef GD_INTERN_H
#define GD_INTERN_H
@ -29,15 +31,11 @@
#include "gd.h"
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
#define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c)))
#ifndef MAX
#define MAX(a,b) ((a)<(b)?(b):(a))
#endif
#define MAX3(a,b,c) ((a)<(b)?(MAX(b,c)):(MAX(a,c)))
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
typedef enum {
HORIZONTAL,

View File

@ -93,9 +93,6 @@ static gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src,
static gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees,
const int bgColor);
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
/* only used here, let do a generic fixed point integers later if required by other
part of GD */
typedef long gdFixed;

View File

@ -71,10 +71,6 @@
#define GD_INDEXED 4
#define GD_RGB 5
#define MIN(a,b) (a < b) ? a : b;
#define MAX(a,b) (a > b) ? a : b;
typedef struct tiff_handle {
int size;
int pos;

View File

@ -4,6 +4,7 @@
#include "gd.h"
#include "gd_errors.h"
#include "gd_intern.h"
#include <math.h>
/* In tests this is sufficient to prevent obvious artifacts */
@ -12,9 +13,6 @@
#define PI 3.141592
#define DEG2RAD(x) ((x)*PI/180.)
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX4(x,y,z,w) \
((MAX((x),(y))) > (MAX((z),(w))) ? (MAX((x),(y))) : (MAX((z),(w))))
#define MIN4(x,y,z,w) \

View File

@ -3,15 +3,13 @@
#endif
#include "gd.h"
#include "gd_intern.h"
#include <string.h>
#include <stdlib.h>
#define PI 3.141592
#define DEG2RAD(x) ((x)*PI/180.)
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX4(x,y,z,w) \
((MAX((x),(y))) > (MAX((z),(w))) ? (MAX((x),(y))) : (MAX((z),(w))))
#define MIN4(x,y,z,w) \