diff options
| author | George Hazan <ghazan@miranda.im> | 2021-12-26 16:39:04 +0300 |
|---|---|---|
| committer | George Hazan <ghazan@miranda.im> | 2021-12-26 16:39:04 +0300 |
| commit | 62a186697df33c96dc1a6dac0f4dfc38652fb96f (patch) | |
| tree | 1437d0906218fae8827aed384026f2b7e656f4ac /libs/freeimage/src/FreeImageToolkit | |
| parent | fcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff) | |
BYTE -> uint8_t
Diffstat (limited to 'libs/freeimage/src/FreeImageToolkit')
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/BSplineRotate.cpp | 12 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Background.cpp | 34 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Channels.cpp | 10 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp | 108 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Colors.cpp | 50 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp | 90 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Display.cpp | 36 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Flip.cpp | 18 | ||||
| -rw-r--r-- | libs/freeimage/src/FreeImageToolkit/Resize.cpp | 356 |
9 files changed, 357 insertions, 357 deletions
diff --git a/libs/freeimage/src/FreeImageToolkit/BSplineRotate.cpp b/libs/freeimage/src/FreeImageToolkit/BSplineRotate.cpp index 6c4c7a7bd2..64b431fd2d 100644 --- a/libs/freeimage/src/FreeImageToolkit/BSplineRotate.cpp +++ b/libs/freeimage/src/FreeImageToolkit/BSplineRotate.cpp @@ -558,7 +558,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x // buid a grey scale palette RGBQUAD *pal = FreeImage_GetPalette(dst); for(int i = 0; i < 256; i++) { - pal[i].rgbRed = pal[i].rgbGreen = pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = pal[i].rgbGreen = pal[i].rgbBlue = (uint8_t)i; } // allocate a temporary array @@ -570,7 +570,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x // copy data samples for(y = 0; y < height; y++) { double *pImage = &ImageRasterArray[y*width]; - BYTE *src_bits = FreeImage_GetScanLine(dib, height-1-y); + uint8_t *src_bits = FreeImage_GetScanLine(dib, height-1-y); for(x = 0; x < width; x++) { pImage[x] = (double)src_bits[x]; @@ -599,7 +599,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x // visit all pixels of the output image and assign their value for(y = 0; y < height; y++) { - BYTE *dst_bits = FreeImage_GetScanLine(dst, height-1-y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, height-1-y); x0 = a12 * (double)y + x_shift; y0 = a22 * (double)y + y_shift; @@ -618,8 +618,8 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x else { p = (double)InterpolatedValue(ImageRasterArray, width, height, x1, y1, spline); } - // clamp and convert to BYTE - dst_bits[x] = (BYTE)MIN(MAX((int)0, (int)(p + 0.5)), (int)255); + // clamp and convert to uint8_t + dst_bits[x] = (uint8_t)MIN(MAX((int)0, (int)(p + 0.5)), (int)255); } } @@ -646,7 +646,7 @@ FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, int x, y, bpp; int channel, nb_channels; - BYTE *src_bits, *dst_bits; + uint8_t *src_bits, *dst_bits; FIBITMAP *src8 = NULL, *dst8 = NULL, *dst = NULL; if(!FreeImage_HasPixels(dib)) return NULL; diff --git a/libs/freeimage/src/FreeImageToolkit/Background.cpp b/libs/freeimage/src/FreeImageToolkit/Background.cpp index 8706cba729..db4e679d87 100644 --- a/libs/freeimage/src/FreeImageToolkit/Background.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Background.cpp @@ -136,8 +136,8 @@ GetPaletteIndex(FIBITMAP *dib, const RGBQUAD *color, int options, FREE_IMAGE_COL } else { unsigned minimum = UINT_MAX; unsigned ncolors = FreeImage_GetColorsUsed(dib); - BYTE *palette = (BYTE *)FreeImage_GetPalette(dib); - BYTE red, green, blue; + uint8_t *palette = (uint8_t *)FreeImage_GetPalette(dib); + uint8_t red, green, blue; if (!IsVisualGreyscaleImage(dib)) { red = color->rgbRed; green = color->rgbGreen; @@ -189,12 +189,12 @@ GetAlphaBlendedColor(const RGBQUAD *bgcolor, const RGBQUAD *fgcolor, RGBQUAD *bl return FALSE; } - BYTE alpha = fgcolor->rgbReserved; - BYTE not_alpha = ~alpha; + uint8_t alpha = fgcolor->rgbReserved; + uint8_t not_alpha = ~alpha; - blended->rgbRed = (BYTE)( ((WORD)fgcolor->rgbRed * alpha + not_alpha * (WORD)bgcolor->rgbRed) >> 8 ); - blended->rgbGreen = (BYTE)( ((WORD)fgcolor->rgbGreen * alpha + not_alpha * (WORD)bgcolor->rgbGreen) >> 8) ; - blended->rgbBlue = (BYTE)( ((WORD)fgcolor->rgbBlue * alpha + not_alpha * (WORD)bgcolor->rgbBlue) >> 8 ); + blended->rgbRed = (uint8_t)( ((WORD)fgcolor->rgbRed * alpha + not_alpha * (WORD)bgcolor->rgbRed) >> 8 ); + blended->rgbGreen = (uint8_t)( ((WORD)fgcolor->rgbGreen * alpha + not_alpha * (WORD)bgcolor->rgbGreen) >> 8) ; + blended->rgbBlue = (uint8_t)( ((WORD)fgcolor->rgbBlue * alpha + not_alpha * (WORD)bgcolor->rgbBlue) >> 8 ); blended->rgbReserved = 0xFF; return TRUE; @@ -229,8 +229,8 @@ FillBackgroundBitmap(FIBITMAP *dib, const RGBQUAD *color, int options) { FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib); // get a pointer to the first scanline (bottom line) - BYTE *src_bits = FreeImage_GetScanLine(dib, 0); - BYTE *dst_bits = src_bits; + uint8_t *src_bits = FreeImage_GetScanLine(dib, 0); + uint8_t *dst_bits = src_bits; BOOL supports_alpha = ((bpp >= 24) || ((bpp == 8) && (color_type != FIC_PALETTE))); @@ -434,8 +434,8 @@ FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options) { // first, construct the first scanline (bottom line) unsigned bytespp = (FreeImage_GetBPP(dib) / 8); - BYTE *src_bits = FreeImage_GetScanLine(dib, 0); - BYTE *dst_bits = src_bits; + uint8_t *src_bits = FreeImage_GetScanLine(dib, 0); + uint8_t *dst_bits = src_bits; for (unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { memcpy(dst_bits, color, bytespp); dst_bits += bytespp; @@ -554,7 +554,7 @@ FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, cons // Otherwise inject the specified color into the so far // black-only palette. We use color->rgbReserved as the // desired palette index. - BYTE index = ((RGBQUAD *)color)->rgbReserved & 0x01; + uint8_t index = ((RGBQUAD *)color)->rgbReserved & 0x01; upal[index] = *urgb & 0x00FFFFFF; } options |= FI_COLOR_ALPHA_IS_INDEX; @@ -585,7 +585,7 @@ FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, cons // Otherwise inject the specified color into the so far // black-only palette. We use color->rgbReserved as the // desired palette index. - BYTE index = (rgb->rgbReserved & 0x0F); + uint8_t index = (rgb->rgbReserved & 0x0F); ((unsigned *)pal)[index] = *((unsigned *)rgb) & 0x00FFFFFF; } options |= FI_COLOR_ALPHA_IS_INDEX; @@ -616,7 +616,7 @@ FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, cons // Otherwise inject the specified color into the so far // black-only palette. We use color->rgbReserved as the // desired palette index. - BYTE index = rgb->rgbReserved; + uint8_t index = rgb->rgbReserved; ((unsigned *)pal)[index] = *((unsigned *)rgb) & 0x00FFFFFF; } options |= FI_COLOR_ALPHA_IS_INDEX; @@ -636,7 +636,7 @@ FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, cons default: { int bytespp = bpp / 8; for (int i = 0; i < bytespp; i++) { - if (((BYTE *)color)[i] != 0) { + if (((uint8_t *)color)[i] != 0) { FreeImage_FillBackground(bitmap, color, options); break; } @@ -846,8 +846,8 @@ FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, } else { int bytespp = bpp / 8; - BYTE *srcPtr = FreeImage_GetScanLine(src, height - 1 - ((top >= 0) ? 0 : -top)); - BYTE *dstPtr = FreeImage_GetScanLine(dst, newHeight - 1 - ((top <= 0) ? 0 : top)); + uint8_t *srcPtr = FreeImage_GetScanLine(src, height - 1 - ((top >= 0) ? 0 : -top)); + uint8_t *dstPtr = FreeImage_GetScanLine(dst, newHeight - 1 - ((top <= 0) ? 0 : top)); unsigned srcPitch = FreeImage_GetPitch(src); unsigned dstPitch = FreeImage_GetPitch(dst); diff --git a/libs/freeimage/src/FreeImageToolkit/Channels.cpp b/libs/freeimage/src/FreeImageToolkit/Channels.cpp index b373f4046d..18295342fe 100644 --- a/libs/freeimage/src/FreeImageToolkit/Channels.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Channels.cpp @@ -65,7 +65,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) { // build a greyscale palette RGBQUAD *pal = FreeImage_GetPalette(dst); for(int i = 0; i < 256; i++) { - pal[i].rgbBlue = pal[i].rgbGreen = pal[i].rgbRed = (BYTE)i; + pal[i].rgbBlue = pal[i].rgbGreen = pal[i].rgbRed = (uint8_t)i; } // perform extraction @@ -73,8 +73,8 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) { int bytespp = bpp / 8; // bytes / pixel for(unsigned y = 0; y < height; y++) { - BYTE *src_bits = FreeImage_GetScanLine(src, y); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *src_bits = FreeImage_GetScanLine(src, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x] = src_bits[c]; src_bits += bytespp; @@ -250,8 +250,8 @@ FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL chan int bytespp = dst_bpp / 8; // bytes / pixel for(unsigned y = 0; y < dst_height; y++) { - BYTE *src_bits = FreeImage_GetScanLine(src, y); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *src_bits = FreeImage_GetScanLine(src, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < dst_width; x++) { dst_bits[c] = src_bits[x]; dst_bits += bytespp; diff --git a/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp b/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp index ba8985c26c..18088debff 100644 --- a/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp +++ b/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp @@ -42,7 +42,7 @@ /** Skews a row horizontally (with filtered weights). Limited to 45 degree skewing only. Filters two adjacent pixels. -Parameter T can be BYTE, WORD of float. +Parameter T can be uint8_t, WORD of float. @param src Pointer to source image to rotate @param dst Pointer to destination image @param row Row index @@ -72,15 +72,15 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh // calculate the number of samples per pixel const unsigned samples = bytespp / sizeof(T); - BYTE *src_bits = FreeImage_GetScanLine(src, row); - BYTE *dst_bits = FreeImage_GetScanLine(dst, row); + uint8_t *src_bits = FreeImage_GetScanLine(src, row); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, row); // fill gap left of skew with background if(bkcolor) { for(int k = 0; k < iOffset; k++) { memcpy(&dst_bits[k * bytespp], bkcolor, bytespp); } - AssignPixel((BYTE*)&pxlOldLeft[0], (BYTE*)bkcolor, bytespp); + AssignPixel((uint8_t*)&pxlOldLeft[0], (uint8_t*)bkcolor, bytespp); } else { if(iOffset > 0) { memset(dst_bits, 0, iOffset * bytespp); @@ -90,7 +90,7 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh for(unsigned i = 0; i < src_width; i++) { // loop through row pixels - AssignPixel((BYTE*)&pxlSrc[0], (BYTE*)src_bits, bytespp); + AssignPixel((uint8_t*)&pxlSrc[0], (uint8_t*)src_bits, bytespp); // calculate weights for(unsigned j = 0; j < samples; j++) { pxlLeft[j] = static_cast<T>(pxlBkg[j] + (pxlSrc[j] - pxlBkg[j]) * weight + 0.5); @@ -102,10 +102,10 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh for(unsigned j = 0; j < samples; j++) { pxlSrc[j] = pxlSrc[j] - (pxlLeft[j] - pxlOldLeft[j]); } - AssignPixel((BYTE*)&dst_bits[iXPos*bytespp], (BYTE*)&pxlSrc[0], bytespp); + AssignPixel((uint8_t*)&dst_bits[iXPos*bytespp], (uint8_t*)&pxlSrc[0], bytespp); } // save leftover for next pixel in scan - AssignPixel((BYTE*)&pxlOldLeft[0], (BYTE*)&pxlLeft[0], bytespp); + AssignPixel((uint8_t*)&pxlOldLeft[0], (uint8_t*)&pxlLeft[0], bytespp); // next pixel in scan src_bits += bytespp; @@ -118,7 +118,7 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh dst_bits = FreeImage_GetScanLine(dst, row) + iXPos * bytespp; // If still in image bounds, put leftovers there - AssignPixel((BYTE*)dst_bits, (BYTE*)&pxlOldLeft[0], bytespp); + AssignPixel((uint8_t*)dst_bits, (uint8_t*)&pxlOldLeft[0], bytespp); // clear to the right of the skewed line with background dst_bits += bytespp; @@ -153,7 +153,7 @@ HorizontalSkew(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double dWeigh case 8: case 24: case 32: - HorizontalSkewT<BYTE>(src, dst, row, iOffset, dWeight, bkcolor); + HorizontalSkewT<uint8_t>(src, dst, row, iOffset, dWeight, bkcolor); break; } break; @@ -173,7 +173,7 @@ HorizontalSkew(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double dWeigh /** Skews a column vertically (with filtered weights). Limited to 45 degree skewing only. Filters two adjacent pixels. -Parameter T can be BYTE, WORD of float. +Parameter T can be uint8_t, WORD of float. @param src Pointer to source image to rotate @param dst Pointer to destination image @param col Column index @@ -207,8 +207,8 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight, const unsigned dst_pitch = FreeImage_GetPitch(dst); const unsigned index = col * bytespp; - BYTE *src_bits = FreeImage_GetBits(src) + index; - BYTE *dst_bits = FreeImage_GetBits(dst) + index; + uint8_t *src_bits = FreeImage_GetBits(src) + index; + uint8_t *dst_bits = FreeImage_GetBits(dst) + index; // fill gap above skew with background if(bkcolor) { @@ -227,7 +227,7 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight, for(unsigned i = 0; i < src_height; i++) { // loop through column pixels - AssignPixel((BYTE*)(&pxlSrc[0]), src_bits, bytespp); + AssignPixel((uint8_t*)(&pxlSrc[0]), src_bits, bytespp); // calculate weights for(unsigned j = 0; j < samples; j++) { pxlLeft[j] = static_cast<T>(pxlBkg[j] + (pxlSrc[j] - pxlBkg[j]) * weight + 0.5); @@ -240,10 +240,10 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight, pxlSrc[j] = pxlSrc[j] - (pxlLeft[j] - pxlOldLeft[j]); } dst_bits = FreeImage_GetScanLine(dst, iYPos) + index; - AssignPixel(dst_bits, (BYTE*)(&pxlSrc[0]), bytespp); + AssignPixel(dst_bits, (uint8_t*)(&pxlSrc[0]), bytespp); } // save leftover for next pixel in scan - AssignPixel((BYTE*)(&pxlOldLeft[0]), (BYTE*)(&pxlLeft[0]), bytespp); + AssignPixel((uint8_t*)(&pxlOldLeft[0]), (uint8_t*)(&pxlLeft[0]), bytespp); // next pixel in scan src_bits += src_pitch; @@ -255,13 +255,13 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight, dst_bits = FreeImage_GetScanLine(dst, iYPos) + index; // if still in image bounds, put leftovers there - AssignPixel((BYTE*)(dst_bits), (BYTE*)(&pxlOldLeft[0]), bytespp); + AssignPixel((uint8_t*)(dst_bits), (uint8_t*)(&pxlOldLeft[0]), bytespp); // clear below skewed line with background if(bkcolor) { while(++iYPos < (int)dst_height) { dst_bits += dst_pitch; - AssignPixel((BYTE*)(dst_bits), (BYTE*)(bkcolor), bytespp); + AssignPixel((uint8_t*)(dst_bits), (uint8_t*)(bkcolor), bytespp); } } else { while(++iYPos < (int)dst_height) { @@ -292,7 +292,7 @@ VerticalSkew(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double dWeight, case 8: case 24: case 32: - VerticalSkewT<BYTE>(src, dst, col, iOffset, dWeight, bkcolor); + VerticalSkewT<uint8_t>(src, dst, col, iOffset, dWeight, bkcolor); break; } break; @@ -341,25 +341,25 @@ Rotate90(FIBITMAP *src) { if(bpp == 1) { // speedy rotate for BW images - BYTE *bsrc = FreeImage_GetBits(src); - BYTE *bdest = FreeImage_GetBits(dst); + uint8_t *bsrc = FreeImage_GetBits(src); + uint8_t *bdest = FreeImage_GetBits(dst); - BYTE *dbitsmax = bdest + dst_height * dst_pitch - 1; + uint8_t *dbitsmax = bdest + dst_height * dst_pitch - 1; for(unsigned y = 0; y < src_height; y++) { // figure out the column we are going to be copying to const div_t div_r = div(y, 8); // set bit pos of src column byte - const BYTE bitpos = (BYTE)(128 >> div_r.rem); - BYTE *srcdisp = bsrc + y * src_pitch; + const uint8_t bitpos = (uint8_t)(128 >> div_r.rem); + uint8_t *srcdisp = bsrc + y * src_pitch; for(unsigned x = 0; x < src_pitch; x++) { // get source bits - BYTE *sbits = srcdisp + x; + uint8_t *sbits = srcdisp + x; // get destination column - BYTE *nrow = bdest + (dst_height - 1 - (x * 8)) * dst_pitch + div_r.quot; + uint8_t *nrow = bdest + (dst_height - 1 - (x * 8)) * dst_pitch + div_r.quot; for (int z = 0; z < 8; z++) { // get destination byte - BYTE *dbits = nrow - z * dst_pitch; + uint8_t *dbits = nrow - z * dst_pitch; if ((dbits < bdest) || (dbits > dbitsmax)) break; if (*sbits & (128 >> z)) *dbits |= bitpos; } @@ -375,8 +375,8 @@ Rotate90(FIBITMAP *src) { // speed somehow, but once you drop out of CPU's cache, things will slow down drastically. // For older CPUs with less cache, lower value would yield better results. - BYTE *bsrc = FreeImage_GetBits(src); // source pixels - BYTE *bdest = FreeImage_GetBits(dst); // destination pixels + uint8_t *bsrc = FreeImage_GetBits(src); // source pixels + uint8_t *bdest = FreeImage_GetBits(dst); // destination pixels // calculate the number of bytes per pixel (1 for 8-bit, 3 for 24-bit or 4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); @@ -390,9 +390,9 @@ Rotate90(FIBITMAP *src) { for(unsigned y = ys; y < MIN(dst_height, ys + RBLOCK); y++) { // do rotation const unsigned y2 = dst_height - y - 1; // point to src pixel at (y2, xs) - BYTE *src_bits = bsrc + (xs * src_pitch) + (y2 * bytespp); + uint8_t *src_bits = bsrc + (xs * src_pitch) + (y2 * bytespp); // point to dst pixel at (xs, y) - BYTE *dst_bits = bdest + (y * dst_pitch) + (xs * bytespp); + uint8_t *dst_bits = bdest + (y * dst_pitch) + (xs * bytespp); for(unsigned x = xs; x < MIN(dst_width, xs + RBLOCK); x++) { // dst.SetPixel(x, y, src.GetPixel(y2, x)); AssignPixel(dst_bits, src_bits, bytespp); @@ -411,15 +411,15 @@ Rotate90(FIBITMAP *src) { case FIT_RGBF: case FIT_RGBAF: { - BYTE *bsrc = FreeImage_GetBits(src); // source pixels - BYTE *bdest = FreeImage_GetBits(dst); // destination pixels + uint8_t *bsrc = FreeImage_GetBits(src); // source pixels + uint8_t *bdest = FreeImage_GetBits(dst); // destination pixels // calculate the number of bytes per pixel const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < dst_height; y++) { - BYTE *src_bits = bsrc + (src_width - 1 - y) * bytespp; - BYTE *dst_bits = bdest + (y * dst_pitch); + uint8_t *src_bits = bsrc + (src_width - 1 - y) * bytespp; + uint8_t *dst_bits = bdest + (y * dst_pitch); for(unsigned x = 0; x < dst_width; x++) { AssignPixel(dst_bits, src_bits, bytespp); src_bits += src_pitch; @@ -459,8 +459,8 @@ Rotate180(FIBITMAP *src) { case FIT_BITMAP: if(bpp == 1) { for(int y = 0; y < src_height; y++) { - BYTE *src_bits = FreeImage_GetScanLine(src, y); - BYTE *dst_bits = FreeImage_GetScanLine(dst, dst_height - y - 1); + uint8_t *src_bits = FreeImage_GetScanLine(src, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, dst_height - y - 1); for(int x = 0; x < src_width; x++) { // get bit at (x, y) k = (src_bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; @@ -483,8 +483,8 @@ Rotate180(FIBITMAP *src) { const int bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(y = 0; y < src_height; y++) { - BYTE *src_bits = FreeImage_GetScanLine(src, y); - BYTE *dst_bits = FreeImage_GetScanLine(dst, dst_height - y - 1) + (dst_width - 1) * bytespp; + uint8_t *src_bits = FreeImage_GetScanLine(src, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, dst_height - y - 1) + (dst_width - 1) * bytespp; for(x = 0; x < src_width; x++) { // get pixel at (x, y) // set pixel at (dst_width - x - 1, dst_height - y - 1) @@ -533,25 +533,25 @@ Rotate270(FIBITMAP *src) { if(bpp == 1) { // speedy rotate for BW images - BYTE *bsrc = FreeImage_GetBits(src); - BYTE *bdest = FreeImage_GetBits(dst); - BYTE *dbitsmax = bdest + dst_height * dst_pitch - 1; + uint8_t *bsrc = FreeImage_GetBits(src); + uint8_t *bdest = FreeImage_GetBits(dst); + uint8_t *dbitsmax = bdest + dst_height * dst_pitch - 1; dlineup = 8 * dst_pitch - dst_width; for(unsigned y = 0; y < src_height; y++) { // figure out the column we are going to be copying to const div_t div_r = div(y + dlineup, 8); // set bit pos of src column byte - const BYTE bitpos = (BYTE)(1 << div_r.rem); - const BYTE *srcdisp = bsrc + y * src_pitch; + const uint8_t bitpos = (uint8_t)(1 << div_r.rem); + const uint8_t *srcdisp = bsrc + y * src_pitch; for(unsigned x = 0; x < src_pitch; x++) { // get source bits - const BYTE *sbits = srcdisp + x; + const uint8_t *sbits = srcdisp + x; // get destination column - BYTE *nrow = bdest + (x * 8) * dst_pitch + dst_pitch - 1 - div_r.quot; + uint8_t *nrow = bdest + (x * 8) * dst_pitch + dst_pitch - 1 - div_r.quot; for(unsigned z = 0; z < 8; z++) { // get destination byte - BYTE *dbits = nrow + z * dst_pitch; + uint8_t *dbits = nrow + z * dst_pitch; if ((dbits < bdest) || (dbits > dbitsmax)) break; if (*sbits & (128 >> z)) *dbits |= bitpos; } @@ -567,8 +567,8 @@ Rotate270(FIBITMAP *src) { // speed somehow, but once you drop out of CPU's cache, things will slow down drastically. // For older CPUs with less cache, lower value would yield better results. - BYTE *bsrc = FreeImage_GetBits(src); // source pixels - BYTE *bdest = FreeImage_GetBits(dst); // destination pixels + uint8_t *bsrc = FreeImage_GetBits(src); // source pixels + uint8_t *bdest = FreeImage_GetBits(dst); // destination pixels // Calculate the number of bytes per pixel (1 for 8-bit, 3 for 24-bit or 4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); @@ -582,9 +582,9 @@ Rotate270(FIBITMAP *src) { for(unsigned x = xs; x < MIN(dst_width, xs + RBLOCK); x++) { // do rotation x2 = dst_width - x - 1; // point to src pixel at (ys, x2) - BYTE *src_bits = bsrc + (x2 * src_pitch) + (ys * bytespp); + uint8_t *src_bits = bsrc + (x2 * src_pitch) + (ys * bytespp); // point to dst pixel at (x, ys) - BYTE *dst_bits = bdest + (ys * dst_pitch) + (x * bytespp); + uint8_t *dst_bits = bdest + (ys * dst_pitch) + (x * bytespp); for(unsigned y = ys; y < MIN(dst_height, ys + RBLOCK); y++) { // dst.SetPixel(x, y, src.GetPixel(y, x2)); AssignPixel(dst_bits, src_bits, bytespp); @@ -603,15 +603,15 @@ Rotate270(FIBITMAP *src) { case FIT_RGBF: case FIT_RGBAF: { - BYTE *bsrc = FreeImage_GetBits(src); // source pixels - BYTE *bdest = FreeImage_GetBits(dst); // destination pixels + uint8_t *bsrc = FreeImage_GetBits(src); // source pixels + uint8_t *bdest = FreeImage_GetBits(dst); // destination pixels // calculate the number of bytes per pixel const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < dst_height; y++) { - BYTE *src_bits = bsrc + (src_height - 1) * src_pitch + y * bytespp; - BYTE *dst_bits = bdest + (y * dst_pitch); + uint8_t *src_bits = bsrc + (src_height - 1) * src_pitch + y * bytespp; + uint8_t *dst_bits = bdest + (y * dst_pitch); for(unsigned x = 0; x < dst_width; x++) { AssignPixel(dst_bits, src_bits, bytespp); src_bits -= src_pitch; diff --git a/libs/freeimage/src/FreeImageToolkit/Colors.cpp b/libs/freeimage/src/FreeImageToolkit/Colors.cpp index 338e5a40bc..cd67567c0c 100644 --- a/libs/freeimage/src/FreeImageToolkit/Colors.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Colors.cpp @@ -74,7 +74,7 @@ FreeImage_Invert(FIBITMAP *src) { } } else { for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(src, y); + uint8_t *bits = FreeImage_GetScanLine(src, y); for (x = 0; x < FreeImage_GetLine(src); x++) { bits[x] = ~bits[x]; @@ -92,7 +92,7 @@ FreeImage_Invert(FIBITMAP *src) { const unsigned bytespp = FreeImage_GetLine(src) / width; for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(src, y); + uint8_t *bits = FreeImage_GetScanLine(src, y); for(x = 0; x < width; x++) { for(k = 0; k < bytespp; k++) { bits[k] = ~bits[k]; @@ -144,9 +144,9 @@ plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. @see FREE_IMAGE_COLOR_CHANNEL */ BOOL DLL_CALLCONV -FreeImage_AdjustCurve(FIBITMAP *src, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel) { +FreeImage_AdjustCurve(FIBITMAP *src, uint8_t *LUT, FREE_IMAGE_COLOR_CHANNEL channel) { unsigned x, y; - BYTE *bits = NULL; + uint8_t *bits = NULL; if(!FreeImage_HasPixels(src) || !LUT || (FreeImage_GetImageType(src) != FIT_BITMAP)) return FALSE; @@ -268,7 +268,7 @@ less than one darkens it, and greater than one lightens it. */ BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *src, double gamma) { - BYTE LUT[256]; // Lookup table + uint8_t LUT[256]; // Lookup table if(!FreeImage_HasPixels(src) || (gamma <= 0)) return FALSE; @@ -281,7 +281,7 @@ FreeImage_AdjustGamma(FIBITMAP *src, double gamma) { double color = (double)pow((double)i, exponent) * v; if(color > 255) color = 255; - LUT[i] = (BYTE)floor(color + 0.5); + LUT[i] = (uint8_t)floor(color + 0.5); } // Apply the gamma correction @@ -298,7 +298,7 @@ and greater than 0 will make the image brighter. */ BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *src, double percentage) { - BYTE LUT[256]; // Lookup table + uint8_t LUT[256]; // Lookup table double value; if(!FreeImage_HasPixels(src)) @@ -309,7 +309,7 @@ FreeImage_AdjustBrightness(FIBITMAP *src, double percentage) { for(int i = 0; i < 256; i++) { value = i * scale; value = MAX(0.0, MIN(value, 255.0)); - LUT[i] = (BYTE)floor(value + 0.5); + LUT[i] = (uint8_t)floor(value + 0.5); } return FreeImage_AdjustCurve(src, LUT, FICC_RGB); } @@ -324,7 +324,7 @@ and greater than 0 will increase the contrast of the image. */ BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *src, double percentage) { - BYTE LUT[256]; // Lookup table + uint8_t LUT[256]; // Lookup table double value; if(!FreeImage_HasPixels(src)) @@ -335,7 +335,7 @@ FreeImage_AdjustContrast(FIBITMAP *src, double percentage) { for(int i = 0; i < 256; i++) { value = 128 + (i - 128) * scale; value = MAX(0.0, MIN(value, 255.0)); - LUT[i] = (BYTE)floor(value + 0.5); + LUT[i] = (uint8_t)floor(value + 0.5); } return FreeImage_AdjustCurve(src, LUT, FICC_RGB); } @@ -352,8 +352,8 @@ bit depth is not supported (nothing is done). */ BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *src, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel) { - BYTE pixel; - BYTE *bits = NULL; + uint8_t pixel; + uint8_t *bits = NULL; unsigned x, y; if(!FreeImage_HasPixels(src) || !histo) return FALSE; @@ -474,7 +474,7 @@ FreeImage_GetHistogram(FIBITMAP *src, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL cha Better and even faster would be snippet 3: // snippet 3: - BYTE LUT[256]; + uint8_t LUT[256]; FreeImage_GetAdjustColorsLookupTable(LUT, 50.0, 15.0, 1.0, FALSE); FreeImage_AdjustCurve(dib, LUT, FICC_RGB); @@ -499,7 +499,7 @@ FreeImage_GetHistogram(FIBITMAP *src, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL cha compared to a blind lookup table. */ int DLL_CALLCONV -FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert) { +FreeImage_GetAdjustColorsLookupTable(uint8_t *LUT, double brightness, double contrast, double gamma, BOOL invert) { double dblLUT[256]; double value; int result = 0; @@ -508,7 +508,7 @@ FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contra // nothing to do, if all arguments have their default values // return a blind LUT for (int i = 0; i < 256; i++) { - LUT[i] = (BYTE)i; + LUT[i] = (uint8_t)i; } return 0; } @@ -551,11 +551,11 @@ FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contra if (!invert) { for (int i = 0; i < 256; i++) { - LUT[i] = (BYTE)floor(dblLUT[i] + 0.5); + LUT[i] = (uint8_t)floor(dblLUT[i] + 0.5); } } else { for (int i = 0; i < 256; i++) { - LUT[i] = 255 - (BYTE)floor(dblLUT[i] + 0.5); + LUT[i] = 255 - (uint8_t)floor(dblLUT[i] + 0.5); } result++; } @@ -611,7 +611,7 @@ FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contra */ BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert) { - BYTE LUT[256]; + uint8_t LUT[256]; if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) { return FALSE; @@ -751,7 +751,7 @@ FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolor unsigned width = FreeImage_GetWidth(dib); RGBQUAD *a, *b; for (unsigned y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); for (unsigned x = 0; x < width; x++, bits += 3) { for (unsigned j = 0; j < count; j++) { a = srccolors; @@ -778,7 +778,7 @@ FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolor unsigned width = FreeImage_GetWidth(dib); RGBQUAD *a, *b; for (unsigned y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); for (unsigned x = 0; x < width; x++, bits += 4) { for (unsigned j = 0; j < count; j++) { a = srccolors; @@ -864,7 +864,7 @@ FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ign @return Returns the total number of pixels changed. */ unsigned DLL_CALLCONV -FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap) { +FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, uint8_t *srcindices, uint8_t *dstindices, unsigned count, BOOL swap) { unsigned result = 0; if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) { @@ -878,7 +878,7 @@ FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstind unsigned height = FreeImage_GetHeight(dib); unsigned width = FreeImage_GetLine(dib); - BYTE *a, *b; + uint8_t *a, *b; int bpp = FreeImage_GetBPP(dib); switch (bpp) { @@ -890,7 +890,7 @@ FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstind int skip_last = (FreeImage_GetWidth(dib) & 0x01); unsigned max_x = width - 1; for (unsigned y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); for (unsigned x = 0; x < width; x++) { int start = ((skip_last) && (x == max_x)) ? 1 : 0; for (int cn = start; cn < 2; cn++) { @@ -915,7 +915,7 @@ FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstind } case 8: { for (unsigned y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); for (unsigned x = 0; x < width; x++) { for (unsigned j = 0; j < count; j++) { a = srcindices; @@ -960,7 +960,7 @@ FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstind @return Returns the total number of pixels changed. */ unsigned DLL_CALLCONV -FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b) { +FreeImage_SwapPaletteIndices(FIBITMAP *dib, uint8_t *index_a, uint8_t *index_b) { return FreeImage_ApplyPaletteIndexMapping(dib, index_a, index_b, 1, TRUE); } diff --git a/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp b/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp index 6b23acd995..3a9d555ba7 100644 --- a/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp +++ b/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp @@ -67,8 +67,8 @@ Combine1(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)); + uint8_t *src_bits = FreeImage_GetBits(src_dib); // combine images for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { @@ -135,8 +135,8 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned } } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x >> 1); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x >> 1); + uint8_t *src_bits = FreeImage_GetBits(src_dib); // combine images @@ -145,7 +145,7 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned unsigned src_width = FreeImage_GetWidth(src_dib); unsigned src_height = FreeImage_GetHeight(src_dib); - BYTE *buffer = (BYTE *)malloc(src_line * sizeof(BYTE)); + uint8_t *buffer = (uint8_t *)malloc(src_line * sizeof(uint8_t)); if (buffer == NULL) { return FALSE; } @@ -165,7 +165,7 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned // change the values in the temp row to be those from the swap table for (unsigned cols = 0; cols < src_line; cols++) { - buffer[cols] = (BYTE)((swapTable[HINIBBLE(buffer[cols]) >> 4] << 4) + swapTable[LOWNIBBLE(buffer[cols])]); + buffer[cols] = (uint8_t)((swapTable[HINIBBLE(buffer[cols]) >> 4] << 4) + swapTable[LOWNIBBLE(buffer[cols])]); } if (bOddStart) { @@ -204,8 +204,8 @@ Combine8(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x); + uint8_t *src_bits = FreeImage_GetBits(src_dib); if(alpha > 255) { // combine images @@ -219,7 +219,7 @@ Combine8(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned // alpha blend images for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { for (unsigned cols = 0; cols < FreeImage_GetLine(src_dib); cols++) { - dst_bits[cols] = (BYTE)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); + dst_bits[cols] = (uint8_t)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); } dst_bits += FreeImage_GetPitch(dst_dib); @@ -246,8 +246,8 @@ Combine16_555(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 2); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 2); + uint8_t *src_bits = FreeImage_GetBits(src_dib); if (alpha > 255) { for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { @@ -267,19 +267,19 @@ Combine16_555(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi // convert 16-bit colors to 24-bit - color_s.rgbtRed = (BYTE)(((*tmp1 & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) << 3); - color_s.rgbtGreen = (BYTE)(((*tmp1 & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) << 3); - color_s.rgbtBlue = (BYTE)(((*tmp1 & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) << 3); + color_s.rgbtRed = (uint8_t)(((*tmp1 & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) << 3); + color_s.rgbtGreen = (uint8_t)(((*tmp1 & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) << 3); + color_s.rgbtBlue = (uint8_t)(((*tmp1 & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) << 3); - color_t.rgbtRed = (BYTE)(((*tmp2 & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) << 3); - color_t.rgbtGreen = (BYTE)(((*tmp2 & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) << 3); - color_t.rgbtBlue = (BYTE)(((*tmp2 & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) << 3); + color_t.rgbtRed = (uint8_t)(((*tmp2 & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) << 3); + color_t.rgbtGreen = (uint8_t)(((*tmp2 & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) << 3); + color_t.rgbtBlue = (uint8_t)(((*tmp2 & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) << 3); // alpha blend - color_s.rgbtRed = (BYTE)(((color_t.rgbtRed - color_s.rgbtRed) * alpha + (color_s.rgbtRed << 8)) >> 8); - color_s.rgbtGreen = (BYTE)(((color_t.rgbtGreen - color_s.rgbtGreen) * alpha + (color_s.rgbtGreen << 8)) >> 8); - color_s.rgbtBlue = (BYTE)(((color_t.rgbtBlue - color_s.rgbtBlue) * alpha + (color_s.rgbtBlue << 8)) >> 8); + color_s.rgbtRed = (uint8_t)(((color_t.rgbtRed - color_s.rgbtRed) * alpha + (color_s.rgbtRed << 8)) >> 8); + color_s.rgbtGreen = (uint8_t)(((color_t.rgbtGreen - color_s.rgbtGreen) * alpha + (color_s.rgbtGreen << 8)) >> 8); + color_s.rgbtBlue = (uint8_t)(((color_t.rgbtBlue - color_s.rgbtBlue) * alpha + (color_s.rgbtBlue << 8)) >> 8); // convert 24-bit color back to 16-bit @@ -306,8 +306,8 @@ Combine16_565(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 2); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 2); + uint8_t *src_bits = FreeImage_GetBits(src_dib); if (alpha > 255) { for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { @@ -327,19 +327,19 @@ Combine16_565(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi // convert 16-bit colors to 24-bit - color_s.rgbtRed = (BYTE)(((*tmp1 & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) << 3); - color_s.rgbtGreen = (BYTE)(((*tmp1 & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) << 2); - color_s.rgbtBlue = (BYTE)(((*tmp1 & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) << 3); + color_s.rgbtRed = (uint8_t)(((*tmp1 & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) << 3); + color_s.rgbtGreen = (uint8_t)(((*tmp1 & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) << 2); + color_s.rgbtBlue = (uint8_t)(((*tmp1 & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) << 3); - color_t.rgbtRed = (BYTE)(((*tmp2 & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) << 3); - color_t.rgbtGreen = (BYTE)(((*tmp2 & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) << 2); - color_t.rgbtBlue = (BYTE)(((*tmp2 & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) << 3); + color_t.rgbtRed = (uint8_t)(((*tmp2 & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) << 3); + color_t.rgbtGreen = (uint8_t)(((*tmp2 & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) << 2); + color_t.rgbtBlue = (uint8_t)(((*tmp2 & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) << 3); // alpha blend - color_s.rgbtRed = (BYTE)(((color_t.rgbtRed - color_s.rgbtRed) * alpha + (color_s.rgbtRed << 8)) >> 8); - color_s.rgbtGreen = (BYTE)(((color_t.rgbtGreen - color_s.rgbtGreen) * alpha + (color_s.rgbtGreen << 8)) >> 8); - color_s.rgbtBlue = (BYTE)(((color_t.rgbtBlue - color_s.rgbtBlue) * alpha + (color_s.rgbtBlue << 8)) >> 8); + color_s.rgbtRed = (uint8_t)(((color_t.rgbtRed - color_s.rgbtRed) * alpha + (color_s.rgbtRed << 8)) >> 8); + color_s.rgbtGreen = (uint8_t)(((color_t.rgbtGreen - color_s.rgbtGreen) * alpha + (color_s.rgbtGreen << 8)) >> 8); + color_s.rgbtBlue = (uint8_t)(((color_t.rgbtBlue - color_s.rgbtBlue) * alpha + (color_s.rgbtBlue << 8)) >> 8); // convert 24-bit color back to 16-bit @@ -370,8 +370,8 @@ Combine24(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 3); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 3); + uint8_t *src_bits = FreeImage_GetBits(src_dib); if(alpha > 255) { // combine images @@ -385,7 +385,7 @@ Combine24(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned // alpha blend images for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { for (unsigned cols = 0; cols < FreeImage_GetLine(src_dib); cols++) { - dst_bits[cols] = (BYTE)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); + dst_bits[cols] = (uint8_t)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); } dst_bits += FreeImage_GetPitch(dst_dib); @@ -412,8 +412,8 @@ Combine32(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 4); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((FreeImage_GetHeight(dst_dib) - FreeImage_GetHeight(src_dib) - y) * FreeImage_GetPitch(dst_dib)) + (x * 4); + uint8_t *src_bits = FreeImage_GetBits(src_dib); if (alpha > 255) { // combine images @@ -427,7 +427,7 @@ Combine32(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned // alpha blend images for(unsigned rows = 0; rows < FreeImage_GetHeight(src_dib); rows++) { for(unsigned cols = 0; cols < FreeImage_GetLine(src_dib); cols++) { - dst_bits[cols] = (BYTE)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); + dst_bits[cols] = (uint8_t)(((src_bits[cols] - dst_bits[cols]) * alpha + (dst_bits[cols] << 8)) >> 8); } dst_bits += FreeImage_GetPitch(dst_dib); @@ -462,8 +462,8 @@ CombineSameType(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y) { return FALSE; } - BYTE *dst_bits = FreeImage_GetBits(dst_dib) + ((dst_height - src_height - y) * dst_pitch) + (x * (src_line / src_width)); - BYTE *src_bits = FreeImage_GetBits(src_dib); + uint8_t *dst_bits = FreeImage_GetBits(dst_dib) + ((dst_height - src_height - y) * dst_pitch) + (x * (src_line / src_width)); + uint8_t *src_bits = FreeImage_GetBits(src_dib); // combine images for(unsigned rows = 0; rows < src_height; rows++) { @@ -530,7 +530,7 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) { // get the pointers to the bits and such - BYTE *src_bits = FreeImage_GetScanLine(src, src_height - top - dst_height); + uint8_t *src_bits = FreeImage_GetScanLine(src, src_height - top - dst_height); switch(bpp) { case 1: // point to x = 0 @@ -551,7 +551,7 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) { } // point to x = 0 - BYTE *dst_bits = FreeImage_GetBits(dst); + uint8_t *dst_bits = FreeImage_GetBits(dst); // copy the palette @@ -575,7 +575,7 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) { } else if(bpp == 4) { - BYTE shift, value; + uint8_t shift, value; unsigned y_src, y_dst; for(int y = 0; y < dst_height; y++) { @@ -583,10 +583,10 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) { y_dst = y * dst_pitch; for(int x = 0; x < dst_width; x++) { // get nibble at (y, x) in src image - shift = (BYTE)((1 - (left+x) % 2) << 2); + shift = (uint8_t)((1 - (left+x) % 2) << 2); value = (src_bits[y_src + ((left+x) >> 1)] & (0x0F << shift)) >> shift; // set nibble at (y, x) in dst image - shift = (BYTE)((1 - x % 2) << 2); + shift = (uint8_t)((1 - x % 2) << 2); dst_bits[y_dst + (x >> 1)] &= ~(0x0F << shift); dst_bits[y_dst + (x >> 1)] |= ((value & 0x0F) << shift); } @@ -803,7 +803,7 @@ FreeImage_CreateView(FIBITMAP *dib, unsigned left, unsigned top, unsigned right, } unsigned bpp = FreeImage_GetBPP(dib); - BYTE *bits = FreeImage_GetScanLine(dib, height - bottom); + uint8_t *bits = FreeImage_GetScanLine(dib, height - bottom); switch (bpp) { case 1: if (left % 8 != 0) { diff --git a/libs/freeimage/src/FreeImageToolkit/Display.cpp b/libs/freeimage/src/FreeImageToolkit/Display.cpp index aa61f37493..5b879aa656 100644 --- a/libs/freeimage/src/FreeImageToolkit/Display.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Display.cpp @@ -59,8 +59,8 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP int x, y, c; - BYTE alpha = 0, not_alpha; - BYTE index; + uint8_t alpha = 0, not_alpha; + uint8_t index; RGBQUAD fgc; // foreground color RGBQUAD bkc; // background color @@ -76,7 +76,7 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP // retrieve the alpha table from the foreground image BOOL bIsTransparent = FreeImage_IsTransparent(fg); - BYTE *trns = FreeImage_GetTransparencyTable(fg); + uint8_t *trns = FreeImage_GetTransparencyTable(fg); // retrieve the background color from the foreground image BOOL bHasBkColor = FALSE; @@ -99,11 +99,11 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP for(y = 0; y < height; y++) { // foreground - BYTE *fg_bits = FreeImage_GetScanLine(fg, y); + uint8_t *fg_bits = FreeImage_GetScanLine(fg, y); // background - BYTE *bg_bits = FreeImage_GetScanLine(bg, y); + uint8_t *bg_bits = FreeImage_GetScanLine(bg, y); // composite image - BYTE *cp_bits = FreeImage_GetScanLine(composite, y); + uint8_t *cp_bits = FreeImage_GetScanLine(composite, y); for(x = 0; x < width; x++) { @@ -142,9 +142,9 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP // use a checkerboard pattern c = (((y & 0x8) == 0) ^ ((x & 0x8) == 0)) * 192; c = c ? c : 255; - bkc.rgbBlue = (BYTE)c; - bkc.rgbGreen = (BYTE)c; - bkc.rgbRed = (BYTE)c; + bkc.rgbBlue = (uint8_t)c; + bkc.rgbGreen = (uint8_t)c; + bkc.rgbRed = (uint8_t)c; } } @@ -164,10 +164,10 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP } else { // output = alpha * foreground + (1-alpha) * background - not_alpha = (BYTE)~alpha; - cp_bits[FI_RGBA_BLUE] = (BYTE)((alpha * (WORD)fgc.rgbBlue + not_alpha * (WORD)bkc.rgbBlue) >> 8); - cp_bits[FI_RGBA_GREEN] = (BYTE)((alpha * (WORD)fgc.rgbGreen + not_alpha * (WORD)bkc.rgbGreen) >> 8); - cp_bits[FI_RGBA_RED] = (BYTE)((alpha * (WORD)fgc.rgbRed + not_alpha * (WORD)bkc.rgbRed) >> 8); + not_alpha = (uint8_t)~alpha; + cp_bits[FI_RGBA_BLUE] = (uint8_t)((alpha * (WORD)fgc.rgbBlue + not_alpha * (WORD)bkc.rgbBlue) >> 8); + cp_bits[FI_RGBA_GREEN] = (uint8_t)((alpha * (WORD)fgc.rgbGreen + not_alpha * (WORD)bkc.rgbGreen) >> 8); + cp_bits[FI_RGBA_RED] = (uint8_t)((alpha * (WORD)fgc.rgbRed + not_alpha * (WORD)bkc.rgbRed) >> 8); } fg_bits += bytespp; @@ -202,9 +202,9 @@ FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib) { int height = FreeImage_GetHeight(dib); for(int y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); for (int x = 0; x < width; x++, bits += 4) { - const BYTE alpha = bits[FI_RGBA_ALPHA]; + const uint8_t alpha = bits[FI_RGBA_ALPHA]; // slightly faster: care for two special cases if(alpha == 0x00) { // special case for alpha == 0x00 @@ -217,9 +217,9 @@ FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib) { // color * 0xFF / 0xFF = color continue; } else { - bits[FI_RGBA_BLUE] = (BYTE)( (alpha * (WORD)bits[FI_RGBA_BLUE] + 127) / 255 ); - bits[FI_RGBA_GREEN] = (BYTE)( (alpha * (WORD)bits[FI_RGBA_GREEN] + 127) / 255 ); - bits[FI_RGBA_RED] = (BYTE)( (alpha * (WORD)bits[FI_RGBA_RED] + 127) / 255 ); + bits[FI_RGBA_BLUE] = (uint8_t)( (alpha * (WORD)bits[FI_RGBA_BLUE] + 127) / 255 ); + bits[FI_RGBA_GREEN] = (uint8_t)( (alpha * (WORD)bits[FI_RGBA_GREEN] + 127) / 255 ); + bits[FI_RGBA_RED] = (uint8_t)( (alpha * (WORD)bits[FI_RGBA_RED] + 127) / 255 ); } } } diff --git a/libs/freeimage/src/FreeImageToolkit/Flip.cpp b/libs/freeimage/src/FreeImageToolkit/Flip.cpp index b9cd9805aa..3f7bcf972a 100644 --- a/libs/freeimage/src/FreeImageToolkit/Flip.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Flip.cpp @@ -39,13 +39,13 @@ FreeImage_FlipHorizontal(FIBITMAP *src) { unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); // copy between aligned memories - BYTE *new_bits = (BYTE*)FreeImage_Aligned_Malloc(line * sizeof(BYTE), FIBITMAP_ALIGNMENT); + uint8_t *new_bits = (uint8_t*)FreeImage_Aligned_Malloc(line * sizeof(uint8_t), FIBITMAP_ALIGNMENT); if (!new_bits) return FALSE; // mirror the buffer for (unsigned y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(src, y); + uint8_t *bits = FreeImage_GetScanLine(src, y); memcpy(new_bits, bits, line); switch (FreeImage_GetBPP(src)) { @@ -66,7 +66,7 @@ FreeImage_FlipHorizontal(FIBITMAP *src) { for(unsigned c = 0; c < line; c++) { bits[c] = new_bits[line - c - 1]; - BYTE nibble = (bits[c] & 0xF0) >> 4; + uint8_t nibble = (bits[c] & 0xF0) >> 4; bits[c] = bits[c] << 4; bits[c] |= nibble; @@ -76,8 +76,8 @@ FreeImage_FlipHorizontal(FIBITMAP *src) { case 8: { - BYTE *dst_data = (BYTE*) bits; - BYTE *src_data = (BYTE*) (new_bits + line - bytespp); + uint8_t *dst_data = (uint8_t*) bits; + uint8_t *src_data = (uint8_t*) (new_bits + line - bytespp); for(unsigned c = 0; c < width; c++) { *dst_data++ = *src_data--; } @@ -101,8 +101,8 @@ FreeImage_FlipHorizontal(FIBITMAP *src) { case 96: case 128: { - BYTE *dst_data = (BYTE*) bits; - BYTE *src_data = (BYTE*) (new_bits + line - bytespp); + uint8_t *dst_data = (uint8_t*) bits; + uint8_t *src_data = (uint8_t*) (new_bits + line - bytespp); for(unsigned c = 0; c < width; c++) { for(unsigned k = 0; k < bytespp; k++) { *dst_data++ = src_data[k]; @@ -129,7 +129,7 @@ Flip the image vertically along the horizontal axis. BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *src) { - BYTE *From, *Mid; + uint8_t *From, *Mid; if (!FreeImage_HasPixels(src)) return FALSE; @@ -139,7 +139,7 @@ FreeImage_FlipVertical(FIBITMAP *src) { unsigned height = FreeImage_GetHeight(src); // copy between aligned memories - Mid = (BYTE*)FreeImage_Aligned_Malloc(pitch * sizeof(BYTE), FIBITMAP_ALIGNMENT); + Mid = (uint8_t*)FreeImage_Aligned_Malloc(pitch * sizeof(uint8_t), FIBITMAP_ALIGNMENT); if (!Mid) return FALSE; From = FreeImage_GetBits(src); diff --git a/libs/freeimage/src/FreeImageToolkit/Resize.cpp b/libs/freeimage/src/FreeImageToolkit/Resize.cpp index 82edb9da72..9781be9788 100644 --- a/libs/freeimage/src/FreeImageToolkit/Resize.cpp +++ b/libs/freeimage/src/FreeImageToolkit/Resize.cpp @@ -127,7 +127,7 @@ GetRGBAPalette(FIBITMAP *dib, RGBQUAD * const buffer) { memcpy(buffer, FreeImage_GetPalette(dib), ncolors * sizeof(RGBQUAD)); // merge the transparency table const unsigned ntransp = MIN(ncolors, FreeImage_GetTransparencyCount(dib)); - const BYTE * const tt = FreeImage_GetTransparencyTable(dib); + const uint8_t * const tt = FreeImage_GetTransparencyTable(dib); for (unsigned i = 0; i < ntransp; i++) { buffer[i].rgbReserved = tt[i]; } @@ -527,8 +527,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we have got a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE * const dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t * const dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -540,19 +540,19 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scan between boundaries // accumulate weighted effect of each neighboring pixel const unsigned pixel = (src_bits[i >> 3] & (0x80 >> (i & 0x07))) != 0; - value += (weightsTable.getWeight(x, i - iLeft) * (double)*(BYTE *)&src_pal[pixel]); + value += (weightsTable.getWeight(x, i - iLeft) * (double)*(uint8_t *)&src_pal[pixel]); } // clamp and place result in destination pixel - dst_bits[x] = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + dst_bits[x] = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); } } } else { // we do not have a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE * const dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t * const dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -569,7 +569,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig value *= 0xFF; // clamp and place result in destination pixel - dst_bits[x] = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + dst_bits[x] = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); } } } @@ -584,8 +584,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we have got a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -598,16 +598,16 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i - iLeft); const unsigned pixel = (src_bits[i >> 3] & (0x80 >> (i & 0x07))) != 0; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -615,8 +615,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we do not have a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -633,7 +633,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig value *= 0xFF; // clamp and place result in destination pixel - const BYTE bval = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + const uint8_t bval = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits[FI_RGBA_RED] = bval; dst_bits[FI_RGBA_GREEN] = bval; dst_bits[FI_RGBA_BLUE] = bval; @@ -652,8 +652,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -666,7 +666,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i - iLeft); const unsigned pixel = (src_bits[i >> 3] & (0x80 >> (i & 0x07))) != 0; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -674,10 +674,10 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += 4; } } @@ -698,8 +698,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE * const dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t * const dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -711,11 +711,11 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scan between boundaries // accumulate weighted effect of each neighboring pixel const unsigned pixel = i & 0x01 ? src_bits[i >> 1] & 0x0F : src_bits[i >> 1] >> 4; - value += (weightsTable.getWeight(x, i - iLeft) * (double)*(BYTE *)&src_pal[pixel]); + value += (weightsTable.getWeight(x, i - iLeft) * (double)*(uint8_t *)&src_pal[pixel]); } // clamp and place result in destination pixel - dst_bits[x] = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + dst_bits[x] = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); } } } @@ -729,8 +729,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -743,16 +743,16 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i - iLeft); const unsigned pixel = i & 0x01 ? src_bits[i >> 1] & 0x0F : src_bits[i >> 1] >> 4; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -767,8 +767,8 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -781,7 +781,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i - iLeft); const unsigned pixel = i & 0x01 ? src_bits[i >> 1] & 0x0F : src_bits[i >> 1] >> 4; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -789,10 +789,10 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += 4; } } @@ -813,39 +813,39 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we have got a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE * const dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t * const dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * const pixel = src_bits + iLeft; + const uint8_t * const pixel = src_bits + iLeft; double value = 0; // for(i = iLeft to iRight) for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel - value += (weightsTable.getWeight(x, i) * (double)*(BYTE *)&src_pal[pixel[i]]); + value += (weightsTable.getWeight(x, i) * (double)*(uint8_t *)&src_pal[pixel[i]]); } // clamp and place result in destination pixel - dst_bits[x] = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + dst_bits[x] = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); } } } else { // we do not have a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE * const dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t * const dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * const pixel = src_bits + iLeft; + const uint8_t * const pixel = src_bits + iLeft; double value = 0; // for(i = iLeft to iRight) @@ -856,7 +856,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[x] = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + dst_bits[x] = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); } } } @@ -870,14 +870,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we have got a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * const pixel = src_bits + iLeft; + const uint8_t * const pixel = src_bits + iLeft; double r = 0, g = 0, b = 0; // for(i = iLeft to iRight) @@ -885,16 +885,16 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scan between boundaries // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i); - const BYTE *const entry = (BYTE *)&src_pal[pixel[i]]; + const uint8_t *const entry = (uint8_t *)&src_pal[pixel[i]]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -902,14 +902,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we do not have a palette for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * const pixel = src_bits + iLeft; + const uint8_t * const pixel = src_bits + iLeft; double value = 0; // for(i = iLeft to iRight) @@ -921,7 +921,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - const BYTE bval = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + const uint8_t bval = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits[FI_RGBA_RED] = bval; dst_bits[FI_RGBA_GREEN] = bval; dst_bits[FI_RGBA_BLUE] = bval; @@ -938,14 +938,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // we always have got a palette here for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * const pixel = src_bits + iLeft; + const uint8_t * const pixel = src_bits + iLeft; double r = 0, g = 0, b = 0, a = 0; // for(i = iLeft to iRight) @@ -953,7 +953,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scan between boundaries // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(x, i); - const BYTE * const entry = (BYTE *)&src_pal[pixel[i]]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel[i]]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -961,10 +961,10 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += 4; } } @@ -982,7 +982,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row const WORD * const src_bits = (WORD *)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(WORD); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -1003,9 +1003,9 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(((g * 0xFF) / 0x3F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(((g * 0xFF) / 0x3F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -1014,7 +1014,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig for (unsigned y = 0; y < height; y++) { // scale each row const WORD * const src_bits = (WORD *)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row @@ -1035,9 +1035,9 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(((g * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(((g * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -1050,14 +1050,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scale the 24-bit non-transparent image into a 24 bpp destination image for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x * 3; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x * 3; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE * pixel = src_bits + iLeft * 3; + const uint8_t * pixel = src_bits + iLeft * 3; double r = 0, g = 0, b = 0; // for(i = iLeft to iRight) @@ -1072,9 +1072,9 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += 3; } } @@ -1086,14 +1086,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig // scale the 32-bit transparent image into a 32 bpp destination image for (unsigned y = 0; y < height; y++) { // scale each row - const BYTE * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x * 4; - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + const uint8_t * const src_bits = FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x * 4; + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for (unsigned x = 0; x < dst_width; x++) { // loop through row const unsigned iLeft = weightsTable.getLeftBoundary(x); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(x) - iLeft; // retrieve right boundary - const BYTE *pixel = src_bits + iLeft * 4; + const uint8_t *pixel = src_bits + iLeft * 4; double r = 0, g = 0, b = 0, a = 0; // for(i = iLeft to iRight) @@ -1109,10 +1109,10 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += 4; } } @@ -1287,13 +1287,13 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned case FIT_BITMAP: { const unsigned dst_pitch = FreeImage_GetPitch(dst); - BYTE * const dst_base = FreeImage_GetBits(dst); + uint8_t * const dst_base = FreeImage_GetBits(dst); switch(FreeImage_GetBPP(src)) { case 1: { const unsigned src_pitch = FreeImage_GetPitch(src); - const BYTE * const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + (src_offset_x >> 3); + const uint8_t * const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + (src_offset_x >> 3); switch(FreeImage_GetBPP(dst)) { case 8: @@ -1303,7 +1303,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we have got a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x; + uint8_t *dst_bits = dst_base + x; const unsigned index = x >> 3; const unsigned mask = 0x80 >> (x & 0x07); @@ -1312,20 +1312,20 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double value = 0; for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel const unsigned pixel = (*src_bits & mask) != 0; - value += (weightsTable.getWeight(y, i) * (double)*(BYTE *)&src_pal[pixel]); + value += (weightsTable.getWeight(y, i) * (double)*(uint8_t *)&src_pal[pixel]); src_bits += src_pitch; } value *= 0xFF; // clamp and place result in destination pixel - *dst_bits = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + *dst_bits = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1333,7 +1333,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we do not have a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x; + uint8_t *dst_bits = dst_base + x; const unsigned index = x >> 3; const unsigned mask = 0x80 >> (x & 0x07); @@ -1342,7 +1342,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double value = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1354,7 +1354,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned value *= 0xFF; // clamp and place result in destination pixel - *dst_bits = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + *dst_bits = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1369,7 +1369,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we have got a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; const unsigned index = x >> 3; const unsigned mask = 0x80 >> (x & 0x07); @@ -1378,7 +1378,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1386,7 +1386,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); const unsigned pixel = (*src_bits & mask) != 0; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1394,9 +1394,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1404,7 +1404,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we do not have a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; const unsigned index = x >> 3; const unsigned mask = 0x80 >> (x & 0x07); @@ -1413,7 +1413,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double value = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1425,7 +1425,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned value *= 0xFF; // clamp and place result in destination pixel - const BYTE bval = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + const uint8_t bval = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits[FI_RGBA_RED] = bval; dst_bits[FI_RGBA_GREEN] = bval; dst_bits[FI_RGBA_BLUE] = bval; @@ -1442,7 +1442,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we always have got a palette here for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 4; + uint8_t *dst_bits = dst_base + x * 4; const unsigned index = x >> 3; const unsigned mask = 0x80 >> (x & 0x07); @@ -1451,7 +1451,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0, a = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1459,7 +1459,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); const unsigned pixel = (*src_bits & mask) != 0; - const BYTE * const entry = (BYTE *)&src_pal[pixel]; + const uint8_t * const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1468,10 +1468,10 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1484,7 +1484,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned case 4: { const unsigned src_pitch = FreeImage_GetPitch(src); - const BYTE *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + (src_offset_x >> 1); + const uint8_t *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + (src_offset_x >> 1); switch(FreeImage_GetBPP(dst)) { case 8: @@ -1493,7 +1493,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we always have got a palette for 4-bit images for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x; + uint8_t *dst_bits = dst_base + x; const unsigned index = x >> 1; // scale each column @@ -1501,19 +1501,19 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double value = 0; for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel const unsigned pixel = x & 0x01 ? *src_bits & 0x0F : *src_bits >> 4; - value += (weightsTable.getWeight(y, i) * (double)*(BYTE *)&src_pal[pixel]); + value += (weightsTable.getWeight(y, i) * (double)*(uint8_t *)&src_pal[pixel]); src_bits += src_pitch; } // clamp and place result in destination pixel - *dst_bits = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + *dst_bits = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1526,7 +1526,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we always have got a palette for 4-bit images for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; const unsigned index = x >> 1; // scale each column @@ -1534,7 +1534,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1542,7 +1542,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); const unsigned pixel = x & 0x01 ? *src_bits & 0x0F : *src_bits >> 4; - const BYTE *const entry = (BYTE *)&src_pal[pixel]; + const uint8_t *const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1550,9 +1550,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1565,7 +1565,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we always have got a palette for 4-bit images for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 4; + uint8_t *dst_bits = dst_base + x * 4; const unsigned index = x >> 1; // scale each column @@ -1573,7 +1573,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0, a = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1581,7 +1581,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); const unsigned pixel = x & 0x01 ? *src_bits & 0x0F : *src_bits >> 4; - const BYTE *const entry = (BYTE *)&src_pal[pixel]; + const uint8_t *const entry = (uint8_t *)&src_pal[pixel]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1590,10 +1590,10 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1606,7 +1606,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned case 8: { const unsigned src_pitch = FreeImage_GetPitch(src); - const BYTE *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x; + const uint8_t *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x; switch(FreeImage_GetBPP(dst)) { case 8: @@ -1616,25 +1616,25 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we have got a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x; + uint8_t *dst_bits = dst_base + x; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + x; + const uint8_t *src_bits = src_base + iLeft * src_pitch + x; double value = 0; for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel - value += (weightsTable.getWeight(y, i) * (double)*(BYTE *)&src_pal[*src_bits]); + value += (weightsTable.getWeight(y, i) * (double)*(uint8_t *)&src_pal[*src_bits]); src_bits += src_pitch; } // clamp and place result in destination pixel - *dst_bits = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + *dst_bits = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1642,14 +1642,14 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we do not have a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x; + uint8_t *dst_bits = dst_base + x; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + x; + const uint8_t *src_bits = src_base + iLeft * src_pitch + x; double value = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1660,7 +1660,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - *dst_bits = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + *dst_bits = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1675,21 +1675,21 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we have got a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + x; + const uint8_t *src_bits = src_base + iLeft * src_pitch + x; double r = 0, g = 0, b = 0; for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); - const BYTE * const entry = (BYTE *)&src_pal[*src_bits]; + const uint8_t * const entry = (uint8_t *)&src_pal[*src_bits]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1697,9 +1697,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1707,14 +1707,14 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we do not have a palette for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + x; + const uint8_t *src_bits = src_base + iLeft * src_pitch + x; double value = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1725,7 +1725,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - const BYTE bval = (BYTE)CLAMP<int>((int)(value + 0.5), 0, 0xFF); + const uint8_t bval = (uint8_t)CLAMP<int>((int)(value + 0.5), 0, 0xFF); dst_bits[FI_RGBA_RED] = bval; dst_bits[FI_RGBA_GREEN] = bval; dst_bits[FI_RGBA_BLUE] = bval; @@ -1742,21 +1742,21 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // we always have got a palette here for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 4; + uint8_t *dst_bits = dst_base + x * 4; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + x; + const uint8_t *src_bits = src_base + iLeft * src_pitch + x; double r = 0, g = 0, b = 0, a = 0; for (unsigned i = 0; i < iLimit; i++) { // scan between boundaries // accumulate weighted effect of each neighboring pixel const double weight = weightsTable.getWeight(y, i); - const BYTE * const entry = (BYTE *)&src_pal[*src_bits]; + const uint8_t * const entry = (uint8_t *)&src_pal[*src_bits]; r += (weight * (double)entry[FI_RGBA_RED]); g += (weight * (double)entry[FI_RGBA_GREEN]); b += (weight * (double)entry[FI_RGBA_BLUE]); @@ -1765,10 +1765,10 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int)(a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int)(a + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1788,7 +1788,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // image has 565 format for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; // scale each column for (unsigned y = 0; y < dst_height; y++) { @@ -1809,9 +1809,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(((g * 0xFF) / 0x3F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(((g * 0xFF) / 0x3F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1819,7 +1819,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned // image has 555 format for (unsigned x = 0; x < width; x++) { // work on column x in dst - BYTE *dst_bits = dst_base + x * 3; + uint8_t *dst_bits = dst_base + x * 3; // scale each column for (unsigned y = 0; y < dst_height; y++) { @@ -1840,9 +1840,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int)(((g * 0xFF) / 0x1F) + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int)(((r * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int)(((g * 0xFF) / 0x1F) + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int)(((b * 0xFF) / 0x1F) + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1854,19 +1854,19 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned { // scale the 24-bit transparent image into a 24 bpp destination image const unsigned src_pitch = FreeImage_GetPitch(src); - const BYTE *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * 3; + const uint8_t *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * 3; for (unsigned x = 0; x < width; x++) { // work on column x in dst const unsigned index = x * 3; - BYTE *dst_bits = dst_base + index; + uint8_t *dst_bits = dst_base + index; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1880,9 +1880,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int) (r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int) (g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int) (b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int) (r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int) (g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int) (b + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } @@ -1893,19 +1893,19 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned { // scale the 32-bit transparent image into a 32 bpp destination image const unsigned src_pitch = FreeImage_GetPitch(src); - const BYTE *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * 4; + const uint8_t *const src_base = FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * 4; for (unsigned x = 0; x < width; x++) { // work on column x in dst const unsigned index = x * 4; - BYTE *dst_bits = dst_base + index; + uint8_t *dst_bits = dst_base + index; // scale each column for (unsigned y = 0; y < dst_height; y++) { // loop through column const unsigned iLeft = weightsTable.getLeftBoundary(y); // retrieve left boundary const unsigned iLimit = weightsTable.getRightBoundary(y) - iLeft; // retrieve right boundary - const BYTE *src_bits = src_base + iLeft * src_pitch + index; + const uint8_t *src_bits = src_base + iLeft * src_pitch + index; double r = 0, g = 0, b = 0, a = 0; for (unsigned i = 0; i < iLimit; i++) { @@ -1920,10 +1920,10 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned } // clamp and place result in destination pixel - dst_bits[FI_RGBA_RED] = (BYTE)CLAMP<int>((int) (r + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_GREEN] = (BYTE)CLAMP<int>((int) (g + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_BLUE] = (BYTE)CLAMP<int>((int) (b + 0.5), 0, 0xFF); - dst_bits[FI_RGBA_ALPHA] = (BYTE)CLAMP<int>((int) (a + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_RED] = (uint8_t)CLAMP<int>((int) (r + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_GREEN] = (uint8_t)CLAMP<int>((int) (g + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_BLUE] = (uint8_t)CLAMP<int>((int) (b + 0.5), 0, 0xFF); + dst_bits[FI_RGBA_ALPHA] = (uint8_t)CLAMP<int>((int) (a + 0.5), 0, 0xFF); dst_bits += dst_pitch; } } |
