Use wxIntNN types in wxQuantize code instead of INTNN ones.

Rely on the already properly defined wx types instead of using INTNN which
could clash with the system headers (e.g. INT32 is already defined in some
Motif headers) and are not guaranteed to be always defined correctly (while
int is always 32 bit on all currently supported platforms, this is not
guaranteed to always remain the case).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-06-22 14:23:28 +00:00
parent a993ff5255
commit e6d11dc00a

View File

@@ -63,12 +63,6 @@
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
typedef unsigned short UINT16;
typedef signed short INT16;
#if !defined(__WXMOTIF__)
typedef signed int INT32;
#endif
typedef unsigned char JSAMPLE;
typedef JSAMPLE *JSAMPROW;
typedef JSAMPROW *JSAMPARRAY;
@@ -221,7 +215,7 @@ struct jpeg_color_quantizer {
#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */
typedef wxUint16 histcell; /* histogram cell; prefer an unsigned type */
typedef histcell * histptr; /* for pointers to histogram cells */
@@ -255,11 +249,11 @@ typedef hist2d * hist3d; /* type for top-level pointer */
*/
#if BITS_IN_JSAMPLE == 8
typedef INT16 FSERROR; /* 16 bits should be enough */
typedef wxInt16 FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */
#else
typedef INT32 FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
typedef wxInt32 FSERROR; /* may need more than 16 bits */
typedef wxInt32 LOCFSERROR; /* be sure calculation temps are big enough */
#endif
typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */
@@ -348,7 +342,7 @@ typedef struct {
int c1min, c1max;
int c2min, c2max;
/* The volume (actually 2-norm) of the box */
INT32 volume;
wxInt32 volume;
/* The number of nonzero histogram cells within this box */
long colorcount;
} box;
@@ -383,7 +377,7 @@ find_biggest_volume (boxptr boxlist, int numboxes)
{
boxptr boxp;
int i;
INT32 maxv = 0;
wxInt32 maxv = 0;
boxptr which = NULL;
for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
@@ -406,7 +400,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
histptr histp;
int c0,c1,c2;
int c0min,c0max,c1min,c1max,c2min,c2max;
INT32 dist0,dist1,dist2;
wxInt32 dist0,dist1,dist2;
long ccount;
c0min = boxp->c0min; c0max = boxp->c0max;
@@ -746,8 +740,8 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
int maxc0, maxc1, maxc2;
int centerc0, centerc1, centerc2;
int i, x, ncolors;
INT32 minmaxdist, min_dist, max_dist, tdist;
INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */
wxInt32 minmaxdist, min_dist, max_dist, tdist;
wxInt32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */
/* Compute true coordinates of update box's upper corner and center.
* Actually we compute the coordinates of the center of the upper-corner
@@ -871,15 +865,15 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
{
int ic0, ic1, ic2;
int i, icolor;
INT32 * bptr; /* pointer into bestdist[] array */
wxInt32 * bptr; /* pointer into bestdist[] array */
JSAMPLE * cptr; /* pointer into bestcolor[] array */
INT32 dist0, dist1; /* initial distance values */
INT32 dist2; /* current distance in inner loop */
INT32 xx0, xx1; /* distance increments */
INT32 xx2;
INT32 inc0, inc1, inc2; /* initial values for increments */
wxInt32 dist0, dist1; /* initial distance values */
wxInt32 dist2; /* current distance in inner loop */
wxInt32 xx0, xx1; /* distance increments */
wxInt32 xx2;
wxInt32 inc0, inc1, inc2; /* initial values for increments */
/* This array holds the distance to the nearest-so-far color for each cell */
INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
wxInt32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
/* Initialize best-distance for each cell of the update box */
bptr = bestdist;
@@ -1271,7 +1265,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan)
(3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL)
cquantize->fserrors = (INT16*) malloc(arraysize);
cquantize->fserrors = (wxInt16*) malloc(arraysize);
/* Initialize the propagated errors to zero. */
memset((void *) cquantize->fserrors, 0, arraysize);
/* Make the error-limit table if we didn't already. */