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 | |
parent | fcbb395dc7ff3edab972b6d4b27dbbfb3305f5d7 (diff) |
BYTE -> uint8_t
Diffstat (limited to 'libs/freeimage')
55 files changed, 1116 insertions, 1116 deletions
diff --git a/libs/freeimage/src/CacheFile.h b/libs/freeimage/src/CacheFile.h index 7f1ab72a31..6eb1558999 100644 --- a/libs/freeimage/src/CacheFile.h +++ b/libs/freeimage/src/CacheFile.h @@ -43,7 +43,7 @@ static const int BLOCK_SIZE = (64 * 1024) - 8; struct Block { unsigned nr; unsigned next; - BYTE *data; + uint8_t *data; }; #ifdef _WIN32 @@ -67,8 +67,8 @@ public : BOOL open(const std::string& filename = "", BOOL keep_in_memory = TRUE); void close(); - BOOL readFile(BYTE *data, int nr, int size); - int writeFile(BYTE *data, int size); + BOOL readFile(uint8_t *data, int nr, int size); + int writeFile(uint8_t *data, int size); void deleteFile(int nr); private : diff --git a/libs/freeimage/src/FreeImage.h b/libs/freeimage/src/FreeImage.h index 2ce4191136..85f4680ca8 100644 --- a/libs/freeimage/src/FreeImage.h +++ b/libs/freeimage/src/FreeImage.h @@ -151,7 +151,7 @@ FI_STRUCT (FIMULTIBITMAP) { void *data; }; // define portable types for 32-bit / 64-bit OS #include <inttypes.h> typedef int32_t BOOL; -typedef uint8_t BYTE; +typedef uint8_t uint8_t; typedef uint16_t WORD; typedef uint32_t DWORD; typedef int32_t LONG; @@ -160,7 +160,7 @@ typedef uint64_t UINT64; #else // MS is not C99 ISO compliant typedef long BOOL; -typedef unsigned char BYTE; +typedef unsigned char uint8_t; typedef unsigned short WORD; typedef unsigned long DWORD; typedef long LONG; @@ -176,26 +176,26 @@ typedef unsigned __int64 UINT64; typedef struct tagRGBQUAD { #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; + uint8_t rgbBlue; + uint8_t rgbGreen; + uint8_t rgbRed; #else - BYTE rgbRed; - BYTE rgbGreen; - BYTE rgbBlue; + uint8_t rgbRed; + uint8_t rgbGreen; + uint8_t rgbBlue; #endif // FREEIMAGE_COLORORDER - BYTE rgbReserved; + uint8_t rgbReserved; } RGBQUAD; typedef struct tagRGBTRIPLE { #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbtBlue; - BYTE rgbtGreen; - BYTE rgbtRed; + uint8_t rgbtBlue; + uint8_t rgbtGreen; + uint8_t rgbtRed; #else - BYTE rgbtRed; - BYTE rgbtGreen; - BYTE rgbtBlue; + uint8_t rgbtRed; + uint8_t rgbtGreen; + uint8_t rgbtBlue; #endif // FREEIMAGE_COLORORDER } RGBTRIPLE; @@ -832,13 +832,13 @@ DLL_API void DLL_CALLCONV FreeImage_CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL f DLL_API BOOL DLL_CALLCONV FreeImage_Premultiply(HBITMAP hBitmap); // Memory I/O stream routines ----------------------------------------------- -DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); +DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(uint8_t *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0)); DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream); DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin); -DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes); +DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, uint8_t **data, DWORD *size_in_bytes); DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream); DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream); @@ -904,17 +904,17 @@ DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); // FreeImage helper routines ------------------------------------------------ DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); +DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue); +DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue); // Pixel access routines ---------------------------------------------------- -DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); -DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); +DLL_API uint8_t *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); +DLL_API uint8_t *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); +DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value); DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); +DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value); DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); // DIB info routines -------------------------------------------------------- @@ -943,9 +943,9 @@ DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); -DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); +DLL_API uint8_t * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); -DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); +DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, uint8_t *table, int count); DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index); DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib); @@ -965,45 +965,45 @@ DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); // Line conversion routines ------------------------------------------------- -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(uint8_t *target, uint8_t *source, int width_in_pixels); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(uint8_t *target, uint8_t *source, int width_in_pixels); // Smart conversion routines ------------------------------------------------ @@ -1016,12 +1016,12 @@ DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); +DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, uint8_t T); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); +DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(uint8_t *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); +DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBitsEx(BOOL copySource, uint8_t *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); +DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(uint8_t *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToFloat(FIBITMAP *dib); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib); @@ -1044,11 +1044,11 @@ DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color // ZLib interface ----------------------------------------------------------- -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size); +DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size); +DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size); +DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size); +DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size); +DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, uint8_t *source, DWORD source_size); // -------------------------------------------------------------------------- // Metadata routines @@ -1123,18 +1123,18 @@ DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pi DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RescaleRect(FIBITMAP *dib, int dst_width, int dst_height, int left, int top, int right, int bottom, FREE_IMAGE_FILTER filter FI_DEFAULT(FILTER_CATMULLROM), unsigned flags FI_DEFAULT(0)); // color manipulation routines (point operations) -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); +DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, uint8_t *LUT, FREE_IMAGE_COLOR_CHANNEL channel); DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); -DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert); +DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(uint8_t *LUT, double brightness, double contrast, double gamma, BOOL invert); DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE)); DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap); DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b); +DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, uint8_t *srcindices, uint8_t *dstindices, unsigned count, BOOL swap); +DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, uint8_t *index_a, uint8_t *index_b); // channel processing routines DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); diff --git a/libs/freeimage/src/FreeImage/BitmapAccess.cpp b/libs/freeimage/src/FreeImage/BitmapAccess.cpp index e77344e1e1..4f5fea576a 100644 --- a/libs/freeimage/src/FreeImage/BitmapAccess.cpp +++ b/libs/freeimage/src/FreeImage/BitmapAccess.cpp @@ -85,7 +85,7 @@ FI_STRUCT (FREEIMAGEHEADER) { overall, but it requires quite some changes and it will render FreeImage_GetTransparencyTable obsolete in its current form; */ - BYTE transparent_table[256]; + uint8_t transparent_table[256]; /** number of transparent colors */ int transparency_count; /** TRUE if the image is transparent */ @@ -107,12 +107,12 @@ FI_STRUCT (FREEIMAGEHEADER) { /**@name external pixel buffer management */ //@{ /** pointer to user provided pixels, NULL otherwise */ - BYTE *external_bits; + uint8_t *external_bits; /** user provided pitch, 0 otherwise */ unsigned external_pitch; //@} - //BYTE filler[1]; // fill to 32-bit alignment + //uint8_t filler[1]; // fill to 32-bit alignment }; // ---------------------------------------------------------- @@ -201,7 +201,7 @@ This function includes a protection against malicious images, based on a KISS in @param height Image height @param bpp Number of bits-per-pixel @param need_masks We only store the masks (and allocate memory for them) for 16-bit images of type FIT_BITMAP -@return Returns a size in BYTE units +@return Returns a size in uint8_t units @see FreeImage_AllocateBitmap */ static size_t @@ -259,7 +259,7 @@ or NULL, if no masks are present (e.g. for 24 bit images). */ static FREEIMAGERGBMASKS * FreeImage_GetRGBMasks(FIBITMAP *dib) { - return FreeImage_HasRGBMasks(dib) ? (FREEIMAGERGBMASKS *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + return FreeImage_HasRGBMasks(dib) ? (FREEIMAGERGBMASKS *)(((uint8_t *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; } /** @@ -288,7 +288,7 @@ like the ones used in low-level APIs like OpenCL or intrinsics. @return Returns the allocated FIBITMAP if successful, returns NULL otherwise */ static FIBITMAP * -FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { +FreeImage_AllocateBitmap(BOOL header_only, uint8_t *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { // check input variables width = abs(width); @@ -381,7 +381,7 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F return NULL; } - bitmap->data = (BYTE *)FreeImage_Aligned_Malloc(dib_size * sizeof(BYTE), FIBITMAP_ALIGNMENT); + bitmap->data = (uint8_t *)FreeImage_Aligned_Malloc(dib_size * sizeof(uint8_t), FIBITMAP_ALIGNMENT); if (bitmap->data != NULL) { memset(bitmap->data, 0, dib_size); @@ -438,9 +438,9 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F // build a default greyscale palette (very useful for image processing) RGBQUAD *pal = FreeImage_GetPalette(bitmap); for(int i = 0; i < 256; i++) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } } @@ -462,7 +462,7 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F } FIBITMAP * DLL_CALLCONV -FreeImage_AllocateHeaderForBits(BYTE *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { +FreeImage_AllocateHeaderForBits(uint8_t *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { return FreeImage_AllocateBitmap(FALSE, ext_bits, ext_pitch, type, width, height, bpp, red_mask, green_mask, blue_mask); } @@ -538,7 +538,7 @@ FreeImage_Clone(FIBITMAP *dib) { unsigned bpp = FreeImage_GetBPP(dib); // if the FIBITMAP is a wrapper to a user provided pixel buffer, get a pointer to this buffer - const BYTE *ext_bits = ((FREEIMAGEHEADER *)dib->data)->external_bits; + const uint8_t *ext_bits = ((FREEIMAGEHEADER *)dib->data)->external_bits; // check for pixel availability ... BOOL header_only = FreeImage_HasPixels(dib) ? FALSE : TRUE; @@ -634,7 +634,7 @@ FreeImage_Clone(FIBITMAP *dib) { // ---------------------------------------------------------- -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib) { if(!FreeImage_HasPixels(dib)) { return NULL; @@ -649,7 +649,7 @@ FreeImage_GetBits(FIBITMAP *dib) { lp += sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * FreeImage_GetColorsUsed(dib); lp += FreeImage_HasRGBMasks(dib) ? sizeof(DWORD) * 3 : 0; lp += (lp % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - lp % FIBITMAP_ALIGNMENT : 0); - return (BYTE *)lp; + return (uint8_t *)lp; } // ---------------------------------------------------------- @@ -897,7 +897,7 @@ FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) { if(bkgnd_color->rgbRed == pal[i].rgbRed) { if(bkgnd_color->rgbGreen == pal[i].rgbGreen) { if(bkgnd_color->rgbBlue == pal[i].rgbBlue) { - bkcolor->rgbReserved = (BYTE)i; + bkcolor->rgbReserved = (uint8_t)i; return TRUE; } } @@ -959,7 +959,7 @@ FreeImage_IsTransparent(FIBITMAP *dib) { return FALSE; } -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib) { return dib ? ((FREEIMAGEHEADER *)dib->data)->transparent_table : NULL; } @@ -981,7 +981,7 @@ FreeImage_GetTransparencyCount(FIBITMAP *dib) { } void DLL_CALLCONV -FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count) { +FreeImage_SetTransparencyTable(FIBITMAP *dib, uint8_t *table, int count) { if (dib) { count = MAX(0, MIN(count, 256)); if (FreeImage_GetBPP(dib) <= 8) { @@ -1022,7 +1022,7 @@ FreeImage_SetTransparentIndex(FIBITMAP *dib, int index) { if (dib) { int count = FreeImage_GetColorsUsed(dib); if (count) { - BYTE *new_tt = (BYTE *)malloc(count * sizeof(BYTE)); + uint8_t *new_tt = (uint8_t *)malloc(count * sizeof(uint8_t)); memset(new_tt, 0xFF, count); if ((index >= 0) && (index < count)) { new_tt[index] = 0x00; @@ -1049,7 +1049,7 @@ FreeImage_SetTransparentIndex(FIBITMAP *dib, int index) { int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib) { int count = FreeImage_GetTransparencyCount(dib); - BYTE *tt = FreeImage_GetTransparencyTable(dib); + uint8_t *tt = FreeImage_GetTransparencyTable(dib); for (int i = 0; i < count; i++) { if (tt[i] == 0) { return i; @@ -1140,7 +1140,7 @@ FreeImage_GetDIBSize(FIBITMAP *dib) { RGBQUAD * DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib) { - return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((uint8_t *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; } unsigned DLL_CALLCONV @@ -1206,7 +1206,7 @@ FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag // calculate the size of a METADATAHEADER const size_t header_size = sizeof(METADATAHEADER); - handle->data = (BYTE *)malloc(header_size); + handle->data = (uint8_t *)malloc(header_size); if(handle->data) { memset(handle->data, 0, header_size); diff --git a/libs/freeimage/src/FreeImage/CacheFile.cpp b/libs/freeimage/src/FreeImage/CacheFile.cpp index e98906d39e..51065f36bd 100644 --- a/libs/freeimage/src/FreeImage/CacheFile.cpp +++ b/libs/freeimage/src/FreeImage/CacheFile.cpp @@ -113,7 +113,7 @@ CacheFile::cleanupMemCache() { int CacheFile::allocateBlock() { Block *block = new Block; - block->data = new BYTE[BLOCK_SIZE]; + block->data = new uint8_t[BLOCK_SIZE]; block->next = 0; if (!m_free_pages.empty()) { @@ -144,7 +144,7 @@ CacheFile::lockBlock(int nr) { // again as soon as the memory buffer fills up if (m_current_block->data == NULL) { - m_current_block->data = new BYTE[BLOCK_SIZE]; + m_current_block->data = new uint8_t[BLOCK_SIZE]; fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET); fread(m_current_block->data, BLOCK_SIZE, 1, m_file); @@ -197,7 +197,7 @@ CacheFile::deleteBlock(int nr) { } BOOL -CacheFile::readFile(BYTE *data, int nr, int size) { +CacheFile::readFile(uint8_t *data, int nr, int size) { if ((data) && (size > 0)) { int s = 0; int block_nr = nr; @@ -223,7 +223,7 @@ CacheFile::readFile(BYTE *data, int nr, int size) { } int -CacheFile::writeFile(BYTE *data, int size) { +CacheFile::writeFile(uint8_t *data, int size) { if ((data) && (size > 0)) { int nr_blocks_required = 1 + (size / BLOCK_SIZE); int count = 0; diff --git a/libs/freeimage/src/FreeImage/ColorLookup.cpp b/libs/freeimage/src/FreeImage/ColorLookup.cpp index a96bead208..fd77895bad 100644 --- a/libs/freeimage/src/FreeImage/ColorLookup.cpp +++ b/libs/freeimage/src/FreeImage/ColorLookup.cpp @@ -26,9 +26,9 @@ typedef struct tagNamedColor { const char *name; //! color name - BYTE r; //! red value - BYTE g; //! green value - BYTE b; //! blue value + uint8_t r; //! red value + uint8_t g; //! green value + uint8_t b; //! blue value } NamedColor; // -------------------------------------------------------------------------- @@ -554,7 +554,7 @@ static NamedColor X11ColorMap[] = { BOOL DLL_CALLCONV -FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) { +FreeImage_LookupX11Color(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue) { int i; // lookup color @@ -574,7 +574,7 @@ FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nB // grey<num>, or gray<num>, num 1...100 i = strtol(szColor+4, NULL, 10); - *nRed = (BYTE)(255.0/100.0 * i); + *nRed = (uint8_t)(255.0/100.0 * i); *nGreen = *nRed; *nBlue = *nRed; @@ -748,7 +748,7 @@ static NamedColor SVGColorMap[] = { BOOL DLL_CALLCONV -FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) { +FreeImage_LookupSVGColor(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue) { int i; // lookup color @@ -768,7 +768,7 @@ FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nB // grey<num>, or gray<num>, num 1...100 i = strtol(szColor+4, NULL, 10); - *nRed = (BYTE)(255.0/100.0 * i); + *nRed = (uint8_t)(255.0/100.0 * i); *nGreen = *nRed; *nBlue = *nRed; return TRUE; diff --git a/libs/freeimage/src/FreeImage/Conversion.cpp b/libs/freeimage/src/FreeImage/Conversion.cpp index f8d8ce4512..7a700b2e48 100644 --- a/libs/freeimage/src/FreeImage/Conversion.cpp +++ b/libs/freeimage/src/FreeImage/Conversion.cpp @@ -74,9 +74,9 @@ BOOL SwapRedBlue32(FIBITMAP* dib) { const unsigned pitch = FreeImage_GetPitch(dib); const unsigned lineSize = FreeImage_GetLine(dib); - BYTE* line = FreeImage_GetBits(dib); + uint8_t* line = FreeImage_GetBits(dib); for(unsigned y = 0; y < height; ++y, line += pitch) { - for(BYTE* pixel = line; pixel < line + lineSize ; pixel += bytesperpixel) { + for(uint8_t* pixel = line; pixel < line + lineSize ; pixel += bytesperpixel) { INPLACESWAP(pixel[0], pixel[2]); } } @@ -94,7 +94,7 @@ assignRGB(WORD r, WORD g, WORD b, WORD* out) { } static inline void -assignRGB(BYTE r, BYTE g, BYTE b, BYTE* out) { +assignRGB(uint8_t r, uint8_t g, uint8_t b, uint8_t* out) { out[FI_RGBA_RED] = r; out[FI_RGBA_GREEN] = g; out[FI_RGBA_BLUE] = b; @@ -129,7 +129,7 @@ CMYKToRGB(T C, T M, T Y, T K, T* out) { template <class T> static void -_convertCMYKtoRGBA(unsigned width, unsigned height, BYTE* line_start, unsigned pitch, unsigned samplesperpixel) { +_convertCMYKtoRGBA(unsigned width, unsigned height, uint8_t* line_start, unsigned pitch, unsigned samplesperpixel) { const BOOL hasBlack = (samplesperpixel > 3) ? TRUE : FALSE; const T MAX_VAL = std::numeric_limits<T>::max(); @@ -169,7 +169,7 @@ ConvertCMYKtoRGBA(FIBITMAP* dib) { const unsigned width = FreeImage_GetWidth(dib); const unsigned height = FreeImage_GetHeight(dib); - BYTE *line_start = FreeImage_GetScanLine(dib, 0); + uint8_t *line_start = FreeImage_GetScanLine(dib, 0); const unsigned pitch = FreeImage_GetPitch(dib); unsigned samplesperpixel = FreeImage_GetLine(dib) / width / channelSize; @@ -177,7 +177,7 @@ ConvertCMYKtoRGBA(FIBITMAP* dib) { if(channelSize == sizeof(WORD)) { _convertCMYKtoRGBA<WORD>(width, height, line_start, pitch, samplesperpixel); } else { - _convertCMYKtoRGBA<BYTE>(width, height, line_start, pitch, samplesperpixel); + _convertCMYKtoRGBA<uint8_t>(width, height, line_start, pitch, samplesperpixel); } return TRUE; @@ -282,7 +282,7 @@ CIELabToRGB(float L, float a, float b, T *rgb) { template<class T> static void -_convertLABtoRGB(unsigned width, unsigned height, BYTE* line_start, unsigned pitch, unsigned samplesperpixel) { +_convertLABtoRGB(unsigned width, unsigned height, uint8_t* line_start, unsigned pitch, unsigned samplesperpixel) { const unsigned max_val = std::numeric_limits<T>::max(); const float sL = 100.F / max_val; const float sa = 256.F / max_val; @@ -318,13 +318,13 @@ ConvertLABtoRGB(FIBITMAP* dib) { const unsigned width = FreeImage_GetWidth(dib); const unsigned height = FreeImage_GetHeight(dib); - BYTE *line_start = FreeImage_GetScanLine(dib, 0); + uint8_t *line_start = FreeImage_GetScanLine(dib, 0); const unsigned pitch = FreeImage_GetPitch(dib); unsigned samplesperpixel = FreeImage_GetLine(dib) / width / channelSize; if(channelSize == 1) { - _convertLABtoRGB<BYTE>(width, height, line_start, pitch, samplesperpixel); + _convertLABtoRGB<uint8_t>(width, height, line_start, pitch, samplesperpixel); } else { _convertLABtoRGB<WORD>(width, height, line_start, pitch, samplesperpixel); @@ -436,7 +436,7 @@ FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize, int Palet // ========================================================== FIBITMAP * DLL_CALLCONV -FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertFromRawBitsEx(BOOL copySource, uint8_t *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { FIBITMAP *dib = NULL; if(copySource) { @@ -473,15 +473,15 @@ FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type } FIBITMAP * DLL_CALLCONV -FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertFromRawBits(uint8_t *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { return FreeImage_ConvertFromRawBitsEx(TRUE /* copySource */, bits, FIT_BITMAP, width, height, pitch, bpp, red_mask, green_mask, blue_mask, topdown); } void DLL_CALLCONV -FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertToRawBits(uint8_t *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { if (FreeImage_HasPixels(dib) && (bits != NULL)) { for (unsigned i = 0; i < FreeImage_GetHeight(dib); ++i) { - BYTE *scanline = FreeImage_GetScanLine(dib, topdown ? (FreeImage_GetHeight(dib) - i - 1) : i); + uint8_t *scanline = FreeImage_GetScanLine(dib, topdown ? (FreeImage_GetHeight(dib) - i - 1) : i); if ((bpp == 16) && (FreeImage_GetBPP(dib) == 16)) { // convert 555 to 565 or vice versa diff --git a/libs/freeimage/src/FreeImage/Conversion16_555.cpp b/libs/freeimage/src/FreeImage/Conversion16_555.cpp index a51d9ee6a5..ae0a4b6d1a 100644 --- a/libs/freeimage/src/FreeImage/Conversion16_555.cpp +++ b/libs/freeimage/src/FreeImage/Conversion16_555.cpp @@ -32,7 +32,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -43,7 +43,7 @@ FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; BOOL lonibble = FALSE; int x = 0; @@ -64,7 +64,7 @@ FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -75,7 +75,7 @@ FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16_565_To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *src_bits = (WORD *)source; WORD *new_bits = (WORD *)target; @@ -87,7 +87,7 @@ FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pi } void DLL_CALLCONV -FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -98,7 +98,7 @@ FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { diff --git a/libs/freeimage/src/FreeImage/Conversion16_565.cpp b/libs/freeimage/src/FreeImage/Conversion16_565.cpp index 54de0c54c3..e48d53b7ad 100644 --- a/libs/freeimage/src/FreeImage/Conversion16_565.cpp +++ b/libs/freeimage/src/FreeImage/Conversion16_565.cpp @@ -28,7 +28,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -39,7 +39,7 @@ FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; BOOL lonibble = FALSE; int x = 0; @@ -60,7 +60,7 @@ FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -71,7 +71,7 @@ FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16_555_To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *src_bits = (WORD *)source; WORD *new_bits = (WORD *)target; @@ -83,7 +83,7 @@ FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pi } void DLL_CALLCONV -FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -94,7 +94,7 @@ FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { diff --git a/libs/freeimage/src/FreeImage/Conversion24.cpp b/libs/freeimage/src/FreeImage/Conversion24.cpp index c0afe98a7c..9586d853dd 100644 --- a/libs/freeimage/src/FreeImage/Conversion24.cpp +++ b/libs/freeimage/src/FreeImage/Conversion24.cpp @@ -29,9 +29,9 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { - BYTE index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; + uint8_t index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; target[FI_RGBA_BLUE] = palette[index].rgbBlue; target[FI_RGBA_GREEN] = palette[index].rgbGreen; @@ -42,7 +42,7 @@ FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL low_nibble = FALSE; int x = 0; @@ -66,7 +66,7 @@ FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -77,33 +77,33 @@ FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To24_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); target += 3; } } void DLL_CALLCONV -FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To24_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); target += 3; } } void DLL_CALLCONV -FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To24(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = source[FI_RGBA_BLUE]; target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN]; @@ -203,15 +203,15 @@ FreeImage_ConvertTo24Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; RGBTRIPLE *dst_pixel = (RGBTRIPLE*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbtRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbtGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbtBlue = (BYTE)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbtRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbtGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbtBlue = (uint8_t)(src_pixel[cols].blue >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; @@ -230,15 +230,15 @@ FreeImage_ConvertTo24Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; RGBTRIPLE *dst_pixel = (RGBTRIPLE*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbtRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbtGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbtBlue = (BYTE)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbtRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbtGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbtBlue = (uint8_t)(src_pixel[cols].blue >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; diff --git a/libs/freeimage/src/FreeImage/Conversion32.cpp b/libs/freeimage/src/FreeImage/Conversion32.cpp index 17dbe7e7b8..43845e19aa 100644 --- a/libs/freeimage/src/FreeImage/Conversion32.cpp +++ b/libs/freeimage/src/FreeImage/Conversion32.cpp @@ -29,7 +29,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; @@ -42,7 +42,7 @@ FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL low_nibble = FALSE; int x = 0; @@ -67,7 +67,7 @@ FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -78,33 +78,33 @@ FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To32_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); target[FI_RGBA_ALPHA] = 0xFF; target += 4; } } void DLL_CALLCONV -FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To32_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); target[FI_RGBA_ALPHA] = 0xFF; target += 4; } } /* void DLL_CALLCONV -FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To32(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { *(DWORD *)target = (*(DWORD *) source & FI_RGBA_RGB_MASK) | FI_RGBA_ALPHA_MASK; target += 4; @@ -118,7 +118,7 @@ The bug occurs in release mode only, when the image height is equal to 537 (try e.g. a size of 432x537 to reproduce the bug with the optimized function). */ void DLL_CALLCONV -FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To32(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_RED] = source[FI_RGBA_RED]; target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN]; @@ -132,7 +132,7 @@ FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine1To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; @@ -145,7 +145,7 @@ FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_ } void DLL_CALLCONV -FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine4To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { BOOL low_nibble = FALSE; int x = 0; @@ -171,7 +171,7 @@ FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_ } void DLL_CALLCONV -FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine8To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -294,16 +294,16 @@ FreeImage_ConvertTo32Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbBlue = (BYTE)(src_pixel[cols].blue >> 8); - dst_pixel[cols].rgbReserved = (BYTE)0xFF; + dst_pixel[cols].rgbRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbBlue = (uint8_t)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbReserved = (uint8_t)0xFF; } src_bits += src_pitch; dst_bits += dst_pitch; @@ -322,16 +322,16 @@ FreeImage_ConvertTo32Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbBlue = (BYTE)(src_pixel[cols].blue >> 8); - dst_pixel[cols].rgbReserved = (BYTE)(src_pixel[cols].alpha >> 8); + dst_pixel[cols].rgbRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbBlue = (uint8_t)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbReserved = (uint8_t)(src_pixel[cols].alpha >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; diff --git a/libs/freeimage/src/FreeImage/Conversion4.cpp b/libs/freeimage/src/FreeImage/Conversion4.cpp index 165bdc2a00..c1527810d6 100644 --- a/libs/freeimage/src/FreeImage/Conversion4.cpp +++ b/libs/freeimage/src/FreeImage/Conversion4.cpp @@ -26,7 +26,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine1To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++){ if (hinibble == TRUE){ @@ -41,9 +41,9 @@ FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To4(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL hinibble = TRUE; - BYTE index; + uint8_t index; for (int cols = 0; cols < width_in_pixels; cols++){ index = GREY(palette[source[cols]].rgbRed, palette[source[cols]].rgbGreen, palette[source[cols]].rgbBlue); @@ -58,7 +58,7 @@ FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQU } void DLL_CALLCONV -FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To4_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; BOOL hinibble = TRUE; @@ -80,7 +80,7 @@ FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To4_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; BOOL hinibble = TRUE; @@ -102,7 +102,7 @@ FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -118,7 +118,7 @@ FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -160,9 +160,9 @@ FreeImage_ConvertTo4Bits(FIBITMAP *dib) { RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); for(int i = 0; i < 16; i++) { - new_pal[i].rgbRed = (BYTE)((i << 4) + i); - new_pal[i].rgbGreen = (BYTE)((i << 4) + i); - new_pal[i].rgbBlue = (BYTE)((i << 4) + i); + new_pal[i].rgbRed = (uint8_t)((i << 4) + i); + new_pal[i].rgbGreen = (uint8_t)((i << 4) + i); + new_pal[i].rgbBlue = (uint8_t)((i << 4) + i); } switch(bpp) { @@ -182,7 +182,7 @@ FreeImage_ConvertTo4Bits(FIBITMAP *dib) { // Reverse the grayscale palette for(int i = 0; i < 16; i++) { - new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (BYTE)(255 - ((i << 4) + i)); + new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (uint8_t)(255 - ((i << 4) + i)); } } diff --git a/libs/freeimage/src/FreeImage/Conversion8.cpp b/libs/freeimage/src/FreeImage/Conversion8.cpp index 1602c7705c..73820a4d66 100644 --- a/libs/freeimage/src/FreeImage/Conversion8.cpp +++ b/libs/freeimage/src/FreeImage/Conversion8.cpp @@ -30,13 +30,13 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine1To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) target[cols] = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 255 : 0; } void DLL_CALLCONV -FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine4To8(uint8_t *target, uint8_t *source, int width_in_pixels) { unsigned count_new = 0; unsigned count_org = 0; BOOL hinibble = TRUE; @@ -54,7 +54,7 @@ FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To8_555(uint8_t *target, uint8_t *source, int width_in_pixels) { const WORD *const bits = (WORD *)source; for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F, @@ -64,7 +64,7 @@ FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To8_565(uint8_t *target, uint8_t *source, int width_in_pixels) { const WORD *const bits = (WORD *)source; for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F, @@ -74,7 +74,7 @@ FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]); source += 3; @@ -82,7 +82,7 @@ FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]); source += 4; @@ -200,14 +200,14 @@ FreeImage_ConvertTo8Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (unsigned rows = 0; rows < height; rows++) { const WORD *const src_pixel = (WORD*)src_bits; - BYTE *dst_pixel = (BYTE*)dst_bits; + uint8_t *dst_pixel = (uint8_t*)dst_bits; for(unsigned cols = 0; cols < width; cols++) { - dst_pixel[cols] = (BYTE)(src_pixel[cols] >> 8); + dst_pixel[cols] = (uint8_t)(src_pixel[cols] >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; @@ -243,7 +243,7 @@ FreeImage_ConvertToGreyscale(FIBITMAP *dib) { FreeImage_CloneMetadata(new_dib, dib); // Create a greyscale palette - BYTE grey_pal[256]; + uint8_t grey_pal[256]; const RGBQUAD *pal = FreeImage_GetPalette(dib); const unsigned size = CalculateUsedPaletteEntries(bpp); for (unsigned i = 0; i < size; i++) { @@ -251,8 +251,8 @@ FreeImage_ConvertToGreyscale(FIBITMAP *dib) { pal++; } - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); diff --git a/libs/freeimage/src/FreeImage/ConversionFloat.cpp b/libs/freeimage/src/FreeImage/ConversionFloat.cpp index 83114fd381..ca551ab4ad 100644 --- a/libs/freeimage/src/FreeImage/ConversionFloat.cpp +++ b/libs/freeimage/src/FreeImage/ConversionFloat.cpp @@ -82,14 +82,14 @@ FreeImage_ConvertToFloat(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(src); const unsigned dst_pitch = FreeImage_GetPitch(dst); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); switch(src_type) { case FIT_BITMAP: { for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; float *dst_pixel = (float*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] diff --git a/libs/freeimage/src/FreeImage/ConversionRGB16.cpp b/libs/freeimage/src/FreeImage/ConversionRGB16.cpp index 9e6fbc0bec..4852a58866 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGB16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGB16.cpp @@ -88,7 +88,7 @@ FreeImage_ConvertToRGB16(FIBITMAP *dib) { const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); FIRGB16 *dst_bits = (FIRGB16*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x].red = src_bits[FI_RGBA_RED] << 8; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp b/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp index 7e1259668b..c5ecfdf438 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp @@ -88,7 +88,7 @@ FreeImage_ConvertToRGBA16(FIBITMAP *dib) { const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); FIRGBA16 *dst_bits = (FIRGBA16*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x].red = src_bits[FI_RGBA_RED] << 8; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp b/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp index f2bcaa7072..99ece4604d 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp @@ -104,11 +104,11 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { // calculate the number of bytes per pixel (4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; FIRGBAF *dst_pixel = (FIRGBAF*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] @@ -128,8 +128,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_UINT16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const WORD *src_pixel = (WORD*)src_bits; @@ -151,8 +151,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGB16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; @@ -173,8 +173,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGBA16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; @@ -195,8 +195,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_FLOAT: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const float *src_pixel = (float*)src_bits; @@ -219,8 +219,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGBF: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBF.cpp b/libs/freeimage/src/FreeImage/ConversionRGBF.cpp index cd0e875ddc..d1f7611caa 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBF.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBF.cpp @@ -103,11 +103,11 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { // calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; FIRGBF *dst_pixel = (FIRGBF*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] @@ -126,8 +126,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_UINT16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const WORD *src_pixel = (WORD*)src_bits; @@ -148,8 +148,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGB16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGB16 *src_pixel = (FIRGB16*) src_bits; @@ -169,8 +169,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGBA16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBA16 *src_pixel = (FIRGBA16*) src_bits; @@ -190,8 +190,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_FLOAT: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const float *src_pixel = (float*) src_bits; @@ -213,8 +213,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGBAF: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBAF *src_pixel = (FIRGBAF*) src_bits; diff --git a/libs/freeimage/src/FreeImage/ConversionType.cpp b/libs/freeimage/src/FreeImage/ConversionType.cpp index b3eedd25a8..be2000ce33 100644 --- a/libs/freeimage/src/FreeImage/ConversionType.cpp +++ b/libs/freeimage/src/FreeImage/ConversionType.cpp @@ -66,7 +66,7 @@ CONVERT_TYPE<Tdst, Tsrc>::convert(FIBITMAP *src, FREE_IMAGE_TYPE dst_type) { /** Convert a greyscale image of type Tsrc to a 8-bit grayscale dib. Conversion is done using either a linear scaling from [min, max] to [0, 255] - or a rounding from src_pixel to (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); + or a rounding from src_pixel to (uint8_t) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); */ template<class Tsrc> class CONVERT_TO_BYTE @@ -91,9 +91,9 @@ CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) { // build a greyscale palette RGBQUAD *pal = FreeImage_GetPalette(dst); for(int i = 0; i < 256; i++) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } // convert the src image to dst @@ -121,19 +121,19 @@ CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) { // scale to 8-bit for(y = 0; y < height; y++) { Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y)); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(x = 0; x < width; x++) { - dst_bits[x] = (BYTE)( scale * (src_bits[x] - min) + 0.5); + dst_bits[x] = (uint8_t)( scale * (src_bits[x] - min) + 0.5); } } } else { for(y = 0; y < height; y++) { Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y)); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(x = 0; x < width; x++) { // rounding int q = int(src_bits[x] + 0.5); - dst_bits[x] = (BYTE) MIN(255, MAX(0, q)); + dst_bits[x] = (uint8_t) MIN(255, MAX(0, q)); } } } @@ -179,15 +179,15 @@ CONVERT_TO_COMPLEX<Tsrc>::convert(FIBITMAP *src) { // ---------------------------------------------------------- -// Convert from type BYTE to type X -CONVERT_TYPE<unsigned short, BYTE> convertByteToUShort; -CONVERT_TYPE<short, BYTE> convertByteToShort; -CONVERT_TYPE<DWORD, BYTE> convertByteToULong; -CONVERT_TYPE<LONG, BYTE> convertByteToLong; -CONVERT_TYPE<float, BYTE> convertByteToFloat; -CONVERT_TYPE<double, BYTE> convertByteToDouble; +// Convert from type uint8_t to type X +CONVERT_TYPE<unsigned short, uint8_t> convertByteToUShort; +CONVERT_TYPE<short, uint8_t> convertByteToShort; +CONVERT_TYPE<DWORD, uint8_t> convertByteToULong; +CONVERT_TYPE<LONG, uint8_t> convertByteToLong; +CONVERT_TYPE<float, uint8_t> convertByteToFloat; +CONVERT_TYPE<double, uint8_t> convertByteToDouble; -// Convert from type X to type BYTE +// Convert from type X to type uint8_t CONVERT_TO_BYTE<unsigned short> convertUShortToByte; CONVERT_TO_BYTE<short> convertShortToByte; CONVERT_TO_BYTE<DWORD> convertULongToByte; @@ -209,7 +209,7 @@ CONVERT_TYPE<double, LONG> convertLongToDouble; CONVERT_TYPE<double, float> convertFloatToDouble; // Convert from type X to type FICOMPLEX -CONVERT_TO_COMPLEX<BYTE> convertByteToComplex; +CONVERT_TO_COMPLEX<uint8_t> convertByteToComplex; CONVERT_TO_COMPLEX<unsigned short> convertUShortToComplex; CONVERT_TO_COMPLEX<short> convertShortToComplex; CONVERT_TO_COMPLEX<DWORD> convertULongToComplex; diff --git a/libs/freeimage/src/FreeImage/ConversionUINT16.cpp b/libs/freeimage/src/FreeImage/ConversionUINT16.cpp index 37f0450f31..35f1e2fdd0 100644 --- a/libs/freeimage/src/FreeImage/ConversionUINT16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionUINT16.cpp @@ -85,7 +85,7 @@ FreeImage_ConvertToUINT16(FIBITMAP *dib) { case FIT_BITMAP: { for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); WORD *dst_bits = (WORD*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x] = src_bits[x] << 8; diff --git a/libs/freeimage/src/FreeImage/FreeImage.cpp b/libs/freeimage/src/FreeImage/FreeImage.cpp index 0ecf730cd0..e2709853ec 100644 --- a/libs/freeimage/src/FreeImage/FreeImage.cpp +++ b/libs/freeimage/src/FreeImage/FreeImage.cpp @@ -90,7 +90,7 @@ BOOL DLL_CALLCONV FreeImage_IsLittleEndian() { union { DWORD i; - BYTE c[4]; + uint8_t c[4]; } u; u.i = 1; return (u.c[0] != 0); diff --git a/libs/freeimage/src/FreeImage/Halftoning.cpp b/libs/freeimage/src/FreeImage/Halftoning.cpp index 19195ad27a..dd261e12f0 100644 --- a/libs/freeimage/src/FreeImage/Halftoning.cpp +++ b/libs/freeimage/src/FreeImage/Halftoning.cpp @@ -40,7 +40,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { int seed = 0; int x, y, p, pixel, threshold, error; int width, height, pitch; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -66,7 +66,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[0] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[0] = (BYTE)p; + new_bits[0] = (uint8_t)p; } // right border error = 0; @@ -78,7 +78,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[width-1] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[width-1] = (BYTE)p; + new_bits[width-1] = (uint8_t)p; } // top border bits = FreeImage_GetBits(dib); @@ -89,7 +89,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[x] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[x] = (BYTE)p; + new_bits[x] = (uint8_t)p; lerr[x] = INITERR(bits[x], p); } @@ -161,7 +161,7 @@ static int dithervalue(int x, int y, int size) { static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { int x, y; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -172,10 +172,10 @@ static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { // build the dithering matrix int l = (1 << order); // square of dither matrix order; the dimensions of the matrix - BYTE *matrix = (BYTE*)malloc(l*l * sizeof(BYTE)); + uint8_t *matrix = (uint8_t*)malloc(l*l * sizeof(uint8_t)); for(int i = 0; i < l*l; i++) { // according to "Purdue University: Digital Image Processing Laboratory: Image Halftoning, April 30th, 2006 - matrix[i] = (BYTE)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); + matrix[i] = (uint8_t)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); } // perform the dithering @@ -251,7 +251,7 @@ static FIBITMAP* OrderedClusteredDot(FIBITMAP *dib, int order) { int x, y, pixel; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -378,9 +378,9 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Build a greyscale palette (needed by threshold) RGBQUAD *grey_pal = FreeImage_GetPalette(dib8); for(int i = 0; i < 256; i++) { - grey_pal[i].rgbRed = (BYTE)i; - grey_pal[i].rgbGreen = (BYTE)i; - grey_pal[i].rgbBlue = (BYTE)i; + grey_pal[i].rgbRed = (uint8_t)i; + grey_pal[i].rgbGreen = (uint8_t)i; + grey_pal[i].rgbBlue = (uint8_t)i; } // Convert to 1-bit @@ -397,7 +397,7 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Thresholding function // FIBITMAP * DLL_CALLCONV -FreeImage_Threshold(FIBITMAP *dib, BYTE T) { +FreeImage_Threshold(FIBITMAP *dib, uint8_t T) { FIBITMAP *dib8 = NULL; if(!FreeImage_HasPixels(dib)) return NULL; @@ -449,8 +449,8 @@ FreeImage_Threshold(FIBITMAP *dib, BYTE T) { // Perform the thresholding // for(int y = 0; y < height; y++) { - BYTE *bits8 = FreeImage_GetScanLine(dib8, y); - BYTE *bits1 = FreeImage_GetScanLine(new_dib, y); + uint8_t *bits8 = FreeImage_GetScanLine(dib8, y); + uint8_t *bits1 = FreeImage_GetScanLine(new_dib, y); for(int x = 0; x < width; x++) { if(bits8[x] < T) { // Set bit(x, y) to 0 diff --git a/libs/freeimage/src/FreeImage/LFPQuantizer.cpp b/libs/freeimage/src/FreeImage/LFPQuantizer.cpp index 88d9944a9d..342615afc3 100644 --- a/libs/freeimage/src/FreeImage/LFPQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/LFPQuantizer.cpp @@ -48,8 +48,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(dib8); - const BYTE * const src_bits = FreeImage_GetBits(dib); - BYTE * const dst_bits = FreeImage_GetBits(dib8); + const uint8_t * const src_bits = FreeImage_GetBits(dib); + uint8_t * const dst_bits = FreeImage_GetBits(dib8); unsigned last_color = -1; int last_index = 0; @@ -64,8 +64,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv // Process all but the last scanline. for (unsigned y = 0; y < height - 1; ++y) { - BYTE *dst_line = dst_bits + y * dst_pitch; - const BYTE *src_line = src_bits + y * src_pitch; + uint8_t *dst_line = dst_bits + y * dst_pitch; + const uint8_t *src_line = src_bits + y * src_pitch; for (unsigned x = 0; x < width; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { @@ -82,8 +82,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv } // Process all but the last pixel of the last scanline. - BYTE *dst_line = dst_bits + (height - 1) * dst_pitch; - const BYTE *src_line = src_bits + (height - 1) * src_pitch; + uint8_t *dst_line = dst_bits + (height - 1) * dst_pitch; + const uint8_t *src_line = src_bits + (height - 1) * src_pitch; for (unsigned x = 0; x < width - 1; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { @@ -114,8 +114,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv } else { for (unsigned y = 0; y < height; ++y) { - BYTE *dst_line = dst_bits + y * dst_pitch; - const BYTE *src_line = src_bits + y * src_pitch; + uint8_t *dst_line = dst_bits + y * dst_pitch; + const uint8_t *src_line = src_bits + y * src_pitch; for (unsigned x = 0; x < width; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { diff --git a/libs/freeimage/src/FreeImage/MNGHelper.cpp b/libs/freeimage/src/FreeImage/MNGHelper.cpp index 1a7e924751..d89ec23c6b 100644 --- a/libs/freeimage/src/FreeImage/MNGHelper.cpp +++ b/libs/freeimage/src/FreeImage/MNGHelper.cpp @@ -56,9 +56,9 @@ http://libpng.org/pub/mng/spec/ const DWORD JPEG_CHUNK_SIZE = 8192; /** PNG signature */ -static const BYTE g_png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; +static const uint8_t g_png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; /** JNG signature */ -static const BYTE g_jng_signature[8] = { 139, 74, 78, 71, 13, 10, 26, 10 }; +static const uint8_t g_jng_signature[8] = { 139, 74, 78, 71, 13, 10, 26, 10 }; // -------------------------------------------------------------------------- @@ -128,57 +128,57 @@ typedef std::map<std::string, std::string> tEXtMAP; portable, we use ASCII numbers like this, not characters. */ -static BYTE mng_MHDR[5]={ 77, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_BACK[5]={ 66, 65, 67, 75, (BYTE) '\0'}; -static BYTE mng_BASI[5]={ 66, 65, 83, 73, (BYTE) '\0'}; -static BYTE mng_CLIP[5]={ 67, 76, 73, 80, (BYTE) '\0'}; -static BYTE mng_CLON[5]={ 67, 76, 79, 78, (BYTE) '\0'}; -static BYTE mng_DEFI[5]={ 68, 69, 70, 73, (BYTE) '\0'}; -static BYTE mng_DHDR[5]={ 68, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_DISC[5]={ 68, 73, 83, 67, (BYTE) '\0'}; -static BYTE mng_ENDL[5]={ 69, 78, 68, 76, (BYTE) '\0'}; -static BYTE mng_FRAM[5]={ 70, 82, 65, 77, (BYTE) '\0'}; -static BYTE mng_IEND[5]={ 73, 69, 78, 68, (BYTE) '\0'}; -static BYTE mng_IHDR[5]={ 73, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_JHDR[5]={ 74, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_LOOP[5]={ 76, 79, 79, 80, (BYTE) '\0'}; -static BYTE mng_MAGN[5]={ 77, 65, 71, 78, (BYTE) '\0'}; -static BYTE mng_MEND[5]={ 77, 69, 78, 68, (BYTE) '\0'}; -static BYTE mng_MOVE[5]={ 77, 79, 86, 69, (BYTE) '\0'}; -static BYTE mng_PAST[5]={ 80, 65, 83, 84, (BYTE) '\0'}; -static BYTE mng_PLTE[5]={ 80, 76, 84, 69, (BYTE) '\0'}; -static BYTE mng_SAVE[5]={ 83, 65, 86, 69, (BYTE) '\0'}; -static BYTE mng_SEEK[5]={ 83, 69, 69, 75, (BYTE) '\0'}; -static BYTE mng_SHOW[5]={ 83, 72, 79, 87, (BYTE) '\0'}; -static BYTE mng_TERM[5]={ 84, 69, 82, 77, (BYTE) '\0'}; -static BYTE mng_bKGD[5]={ 98, 75, 71, 68, (BYTE) '\0'}; -static BYTE mng_cHRM[5]={ 99, 72, 82, 77, (BYTE) '\0'}; -static BYTE mng_gAMA[5]={103, 65, 77, 65, (BYTE) '\0'}; -static BYTE mng_iCCP[5]={105, 67, 67, 80, (BYTE) '\0'}; -static BYTE mng_nEED[5]={110, 69, 69, 68, (BYTE) '\0'}; -static BYTE mng_pHYg[5]={112, 72, 89, 103, (BYTE) '\0'}; -static BYTE mng_vpAg[5]={118, 112, 65, 103, (BYTE) '\0'}; -static BYTE mng_pHYs[5]={112, 72, 89, 115, (BYTE) '\0'}; -static BYTE mng_sBIT[5]={115, 66, 73, 84, (BYTE) '\0'}; -static BYTE mng_sRGB[5]={115, 82, 71, 66, (BYTE) '\0'}; -static BYTE mng_tRNS[5]={116, 82, 78, 83, (BYTE) '\0'}; +static uint8_t mng_MHDR[5]={ 77, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_BACK[5]={ 66, 65, 67, 75, (uint8_t) '\0'}; +static uint8_t mng_BASI[5]={ 66, 65, 83, 73, (uint8_t) '\0'}; +static uint8_t mng_CLIP[5]={ 67, 76, 73, 80, (uint8_t) '\0'}; +static uint8_t mng_CLON[5]={ 67, 76, 79, 78, (uint8_t) '\0'}; +static uint8_t mng_DEFI[5]={ 68, 69, 70, 73, (uint8_t) '\0'}; +static uint8_t mng_DHDR[5]={ 68, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_DISC[5]={ 68, 73, 83, 67, (uint8_t) '\0'}; +static uint8_t mng_ENDL[5]={ 69, 78, 68, 76, (uint8_t) '\0'}; +static uint8_t mng_FRAM[5]={ 70, 82, 65, 77, (uint8_t) '\0'}; +static uint8_t mng_IEND[5]={ 73, 69, 78, 68, (uint8_t) '\0'}; +static uint8_t mng_IHDR[5]={ 73, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_JHDR[5]={ 74, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_LOOP[5]={ 76, 79, 79, 80, (uint8_t) '\0'}; +static uint8_t mng_MAGN[5]={ 77, 65, 71, 78, (uint8_t) '\0'}; +static uint8_t mng_MEND[5]={ 77, 69, 78, 68, (uint8_t) '\0'}; +static uint8_t mng_MOVE[5]={ 77, 79, 86, 69, (uint8_t) '\0'}; +static uint8_t mng_PAST[5]={ 80, 65, 83, 84, (uint8_t) '\0'}; +static uint8_t mng_PLTE[5]={ 80, 76, 84, 69, (uint8_t) '\0'}; +static uint8_t mng_SAVE[5]={ 83, 65, 86, 69, (uint8_t) '\0'}; +static uint8_t mng_SEEK[5]={ 83, 69, 69, 75, (uint8_t) '\0'}; +static uint8_t mng_SHOW[5]={ 83, 72, 79, 87, (uint8_t) '\0'}; +static uint8_t mng_TERM[5]={ 84, 69, 82, 77, (uint8_t) '\0'}; +static uint8_t mng_bKGD[5]={ 98, 75, 71, 68, (uint8_t) '\0'}; +static uint8_t mng_cHRM[5]={ 99, 72, 82, 77, (uint8_t) '\0'}; +static uint8_t mng_gAMA[5]={103, 65, 77, 65, (uint8_t) '\0'}; +static uint8_t mng_iCCP[5]={105, 67, 67, 80, (uint8_t) '\0'}; +static uint8_t mng_nEED[5]={110, 69, 69, 68, (uint8_t) '\0'}; +static uint8_t mng_pHYg[5]={112, 72, 89, 103, (uint8_t) '\0'}; +static uint8_t mng_vpAg[5]={118, 112, 65, 103, (uint8_t) '\0'}; +static uint8_t mng_pHYs[5]={112, 72, 89, 115, (uint8_t) '\0'}; +static uint8_t mng_sBIT[5]={115, 66, 73, 84, (uint8_t) '\0'}; +static uint8_t mng_sRGB[5]={115, 82, 71, 66, (uint8_t) '\0'}; +static uint8_t mng_tRNS[5]={116, 82, 78, 83, (uint8_t) '\0'}; #if defined(JNG_SUPPORTED) -static BYTE mng_IDAT[5]={ 73, 68, 65, 84, (BYTE) '\0'}; -static BYTE mng_JDAT[5]={ 74, 68, 65, 84, (BYTE) '\0'}; -static BYTE mng_JDAA[5]={ 74, 68, 65, 65, (BYTE) '\0'}; -static BYTE mng_JdAA[5]={ 74, 100, 65, 65, (BYTE) '\0'}; -static BYTE mng_JSEP[5]={ 74, 83, 69, 80, (BYTE) '\0'}; -static BYTE mng_oFFs[5]={111, 70, 70, 115, (BYTE) '\0'}; +static uint8_t mng_IDAT[5]={ 73, 68, 65, 84, (uint8_t) '\0'}; +static uint8_t mng_JDAT[5]={ 74, 68, 65, 84, (uint8_t) '\0'}; +static uint8_t mng_JDAA[5]={ 74, 68, 65, 65, (uint8_t) '\0'}; +static uint8_t mng_JdAA[5]={ 74, 100, 65, 65, (uint8_t) '\0'}; +static uint8_t mng_JSEP[5]={ 74, 83, 69, 80, (uint8_t) '\0'}; +static uint8_t mng_oFFs[5]={111, 70, 70, 115, (uint8_t) '\0'}; #endif -static BYTE mng_hIST[5]={104, 73, 83, 84, (BYTE) '\0'}; -static BYTE mng_iTXt[5]={105, 84, 88, 116, (BYTE) '\0'}; -static BYTE mng_sPLT[5]={115, 80, 76, 84, (BYTE) '\0'}; -static BYTE mng_sTER[5]={115, 84, 69, 82, (BYTE) '\0'}; -static BYTE mng_tEXt[5]={116, 69, 88, 116, (BYTE) '\0'}; -static BYTE mng_tIME[5]={116, 73, 77, 69, (BYTE) '\0'}; -static BYTE mng_zTXt[5]={122, 84, 88, 116, (BYTE) '\0'}; +static uint8_t mng_hIST[5]={104, 73, 83, 84, (uint8_t) '\0'}; +static uint8_t mng_iTXt[5]={105, 84, 88, 116, (uint8_t) '\0'}; +static uint8_t mng_sPLT[5]={115, 80, 76, 84, (uint8_t) '\0'}; +static uint8_t mng_sTER[5]={115, 84, 69, 82, (uint8_t) '\0'}; +static uint8_t mng_tEXt[5]={116, 69, 88, 116, (uint8_t) '\0'}; +static uint8_t mng_tIME[5]={116, 73, 77, 69, (uint8_t) '\0'}; +static uint8_t mng_zTXt[5]={122, 84, 88, 116, (uint8_t) '\0'}; // -------------------------------------------------------------------------- @@ -187,7 +187,7 @@ static BYTE mng_zTXt[5]={122, 84, 88, 116, (BYTE) '\0'}; Convert a chunk name to a unique ID */ static eChunckType -mng_GetChunckType(const BYTE *mChunkName) { +mng_GetChunckType(const uint8_t *mChunkName) { if(memcmp(mChunkName, mng_MHDR, 4) == 0) { return MHDR; } @@ -282,7 +282,7 @@ mng_CountPNGChunks(FreeImageIO *io, fi_handle handle, long inPos, unsigned *m_To long mPos; BOOL mEnd = FALSE; DWORD mLength = 0; - BYTE mChunkName[5]; + uint8_t mChunkName[5]; *m_TotalBytesOfChunks = 0; @@ -355,10 +355,10 @@ Retrieve the position of a chunk in a PNG stream @return Returns TRUE if successful, returns FALSE otherwise */ static BOOL -mng_FindChunk(FIMEMORY *hPngMemory, BYTE *chunk_name, long offset, DWORD *start_pos, DWORD *next_pos) { +mng_FindChunk(FIMEMORY *hPngMemory, uint8_t *chunk_name, long offset, DWORD *start_pos, DWORD *next_pos) { DWORD mLength = 0; - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; *start_pos = 0; @@ -418,7 +418,7 @@ Remove a chunk located at (start_pos, next_pos) in the PNG stream */ static BOOL mng_CopyRemoveChunks(FIMEMORY *hPngMemory, DWORD start_pos, DWORD next_pos) { - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; // length of the chunk to remove @@ -437,7 +437,7 @@ mng_CopyRemoveChunks(FIMEMORY *hPngMemory, DWORD start_pos, DWORD next_pos) { // new file length unsigned buffer_size = size_in_bytes + chunk_length; - BYTE *buffer = (BYTE*)malloc(buffer_size * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(buffer_size * sizeof(uint8_t)); if(!buffer) { return FALSE; } @@ -462,8 +462,8 @@ Insert a chunk just before the inNextChunkName chunk @return Returns TRUE if successfull, returns FALSE otherwise */ static BOOL -mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsertChunk, DWORD inChunkLength, DWORD start_pos, DWORD next_pos) { - BYTE *data = NULL; +mng_CopyInsertChunks(FIMEMORY *hPngMemory, uint8_t *inNextChunkName, uint8_t *inInsertChunk, DWORD inChunkLength, DWORD start_pos, DWORD next_pos) { + uint8_t *data = NULL; DWORD size_in_bytes = 0; // length of the chunk to check @@ -482,7 +482,7 @@ mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsert // new file length unsigned buffer_size = inChunkLength + size_in_bytes; - BYTE *buffer = (BYTE*)malloc(buffer_size * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(buffer_size * sizeof(uint8_t)); if(!buffer) { return FALSE; } @@ -504,7 +504,7 @@ mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsert } static BOOL -mng_RemoveChunk(FIMEMORY *hPngMemory, BYTE *chunk_name) { +mng_RemoveChunk(FIMEMORY *hPngMemory, uint8_t *chunk_name) { BOOL bResult = FALSE; DWORD start_pos = 0; @@ -524,7 +524,7 @@ mng_RemoveChunk(FIMEMORY *hPngMemory, BYTE *chunk_name) { } static BOOL -mng_InsertChunk(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsertChunk, unsigned chunk_length) { +mng_InsertChunk(FIMEMORY *hPngMemory, uint8_t *inNextChunkName, uint8_t *inInsertChunk, unsigned chunk_length) { BOOL bResult = FALSE; DWORD start_pos = 0; @@ -571,7 +571,7 @@ Write a chunk in a PNG stream from the current position. @param hPngMemory PNG stream handle */ static void -mng_WriteChunk(BYTE *chunk_name, BYTE *chunk_data, DWORD length, FIMEMORY *hPngMemory) { +mng_WriteChunk(uint8_t *chunk_name, uint8_t *chunk_data, DWORD length, FIMEMORY *hPngMemory) { DWORD crc_file = 0; // write a PNG chunk ... // - length @@ -610,10 +610,10 @@ The image is assumed to be a greyscale image. @param hPngMemory Output memory stream */ static void -mng_WritePNGStream(DWORD jng_width, DWORD jng_height, BYTE jng_alpha_sample_depth, BYTE *mChunk, DWORD mLength, FIMEMORY *hPngMemory) { +mng_WritePNGStream(DWORD jng_width, DWORD jng_height, uint8_t jng_alpha_sample_depth, uint8_t *mChunk, DWORD mLength, FIMEMORY *hPngMemory) { // PNG grayscale IDAT format - BYTE data[14]; + uint8_t data[14]; // wrap the IDAT chunk as a PNG stream @@ -700,16 +700,16 @@ Read a tEXt chunk and extract the key/value pair. @return Returns TRUE if successful, returns FALSE otherwise */ static BOOL -mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const BYTE *mChunk, DWORD mLength) { +mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const uint8_t *mChunk, DWORD mLength) { std::string key; std::string value; - BYTE *buffer = (BYTE*)malloc(mLength * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(mLength * sizeof(uint8_t)); if(!buffer) { return FALSE; } DWORD pos = 0; - memset(buffer, 0, mLength * sizeof(BYTE)); + memset(buffer, 0, mLength * sizeof(uint8_t)); for(DWORD i = 0; i < mLength; i++) { buffer[pos++] = mChunk[i]; @@ -717,7 +717,7 @@ mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const BYTE *mChunk, DWORD mLength) if(key.size() == 0) { key = (char*)buffer; pos = 0; - memset(buffer, 0, mLength * sizeof(BYTE)); + memset(buffer, 0, mLength * sizeof(uint8_t)); } else { break; } @@ -745,12 +745,12 @@ Load a FIBITMAP from a MNG or a JNG stream FIBITMAP* mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, int flags = 0) { DWORD mLength = 0; - BYTE mChunkName[5]; - BYTE *mChunk = NULL; + uint8_t mChunkName[5]; + uint8_t *mChunk = NULL; DWORD crc_file; long LastOffset; long mOrigPos; - BYTE *PLTE_file_chunk = NULL; // whole PLTE chunk (lentgh, name, array, crc) + uint8_t *PLTE_file_chunk = NULL; // whole PLTE chunk (lentgh, name, array, crc) DWORD PLTE_file_size = 0; // size of PLTE chunk BOOL m_HasGlobalPalette = FALSE; // may turn to TRUE in PLTE chunk @@ -765,14 +765,14 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in // --- DWORD jng_width = 0; DWORD jng_height = 0; - BYTE jng_color_type = 0; - BYTE jng_image_sample_depth = 0; - BYTE jng_image_compression_method = 0; + uint8_t jng_color_type = 0; + uint8_t jng_image_sample_depth = 0; + uint8_t jng_image_compression_method = 0; - BYTE jng_alpha_sample_depth = 0; - BYTE jng_alpha_compression_method = 0; - BYTE jng_alpha_filter_method = 0; - BYTE jng_alpha_interlace_method = 0; + uint8_t jng_alpha_sample_depth = 0; + uint8_t jng_alpha_compression_method = 0; + uint8_t jng_alpha_filter_method = 0; + uint8_t jng_alpha_interlace_method = 0; DWORD mng_frame_width = 0; DWORD mng_frame_height = 0; @@ -816,7 +816,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in mChunkName[4] = '\0'; if(mLength > 0) { - mChunk = (BYTE*)realloc(mChunk, mLength); + mChunk = (uint8_t*)realloc(mChunk, mLength); if(!mChunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -886,7 +886,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in case PLTE: // Global m_HasGlobalPalette = TRUE; PLTE_file_size = mLength + 12; // (lentgh, name, array, crc) = (4, 4, mLength, 4) - PLTE_file_chunk = (BYTE*)realloc(PLTE_file_chunk, PLTE_file_size); + PLTE_file_chunk = (uint8_t*)realloc(PLTE_file_chunk, PLTE_file_size); if(!PLTE_file_chunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -925,7 +925,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in FreeImage_SeekMemory(hPngMemory, 0, SEEK_SET); FreeImage_WriteMemory(g_png_signature, 1, 8, hPngMemory); - mChunk = (BYTE*)realloc(mChunk, m_TotalBytesOfChunks); + mChunk = (uint8_t*)realloc(mChunk, m_TotalBytesOfChunks); if(!mChunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -968,7 +968,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in jng_color_type = mChunk[8]; jng_image_sample_depth = mChunk[9]; jng_image_compression_method = mChunk[10]; - //BYTE jng_image_interlace_method = mChunk[11]; // for debug only + //uint8_t jng_image_interlace_method = mChunk[11]; // for debug only jng_alpha_sample_depth = mChunk[12]; jng_alpha_compression_method = mChunk[13]; @@ -1013,7 +1013,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in // load the PNG alpha layer if(mHasIDAT) { - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; // get a pointer to the IDAT buffer @@ -1052,13 +1052,13 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in case bKGD: memcpy(&bk_red, &mChunk[0], 2); mng_SwapShort(&bk_red); - rgbBkColor.rgbRed = (BYTE)bk_red; + rgbBkColor.rgbRed = (uint8_t)bk_red; memcpy(&bk_green, &mChunk[2], 2); mng_SwapShort(&bk_green); - rgbBkColor.rgbGreen = (BYTE)bk_green; + rgbBkColor.rgbGreen = (uint8_t)bk_green; memcpy(&bk_blue, &mChunk[4], 2); mng_SwapShort(&bk_blue); - rgbBkColor.rgbBlue = (BYTE)bk_blue; + rgbBkColor.rgbBlue = (uint8_t)bk_blue; hasBkColor = TRUE; break; @@ -1143,17 +1143,17 @@ BOOL mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int flags) { DWORD jng_width = 0; DWORD jng_height = 0; - BYTE jng_color_type = 0; - BYTE jng_image_sample_depth = 8; - BYTE jng_image_compression_method = 8; // 8: ISO-10918-1 Huffman-coded baseline JPEG. - BYTE jng_image_interlace_method = 0; + uint8_t jng_color_type = 0; + uint8_t jng_image_sample_depth = 8; + uint8_t jng_image_compression_method = 8; // 8: ISO-10918-1 Huffman-coded baseline JPEG. + uint8_t jng_image_interlace_method = 0; - BYTE jng_alpha_sample_depth = 0; - BYTE jng_alpha_compression_method = 0; - BYTE jng_alpha_filter_method = 0; - BYTE jng_alpha_interlace_method = 0; + uint8_t jng_alpha_sample_depth = 0; + uint8_t jng_alpha_compression_method = 0; + uint8_t jng_alpha_filter_method = 0; + uint8_t jng_alpha_interlace_method = 0; - BYTE buffer[16]; + uint8_t buffer[16]; FIMEMORY *hJngMemory = NULL; FIMEMORY *hJpegMemory = NULL; @@ -1231,7 +1231,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in dib_rgb = NULL; } { - BYTE *jpeg_data = NULL; + uint8_t *jpeg_data = NULL; DWORD size_in_bytes = 0; // get a pointer to the stream buffer @@ -1269,7 +1269,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in bResult = mng_FindChunk(hPngMemory, mng_IDAT, offset, &start_pos, &next_pos); if(!bResult) break; - BYTE *png_data = NULL; + uint8_t *png_data = NULL; DWORD size_in_bytes = 0; // get a pointer to the stream buffer @@ -1291,7 +1291,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in // write the JNG on output stream { - BYTE *jng_data = NULL; + uint8_t *jng_data = NULL; DWORD size_in_bytes = 0; FreeImage_AcquireMemory(hJngMemory, &jng_data, &size_in_bytes); io->write_proc(jng_data, 1, size_in_bytes, handle); diff --git a/libs/freeimage/src/FreeImage/MemoryIO.cpp b/libs/freeimage/src/FreeImage/MemoryIO.cpp index cda97e1e71..bcac67d57d 100644 --- a/libs/freeimage/src/FreeImage/MemoryIO.cpp +++ b/libs/freeimage/src/FreeImage/MemoryIO.cpp @@ -30,11 +30,11 @@ // ===================================================================== FIMEMORY * DLL_CALLCONV -FreeImage_OpenMemory(BYTE *data, DWORD size_in_bytes) { +FreeImage_OpenMemory(uint8_t *data, DWORD size_in_bytes) { // allocate a memory handle FIMEMORY *stream = (FIMEMORY*)malloc(sizeof(FIMEMORY)); if(stream) { - stream->data = (BYTE*)malloc(sizeof(FIMEMORYHEADER)); + stream->data = (uint8_t*)malloc(sizeof(FIMEMORYHEADER)); if(stream->data) { FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data); @@ -45,7 +45,7 @@ FreeImage_OpenMemory(BYTE *data, DWORD size_in_bytes) { if(data && size_in_bytes) { // wrap a user buffer mem_header->delete_me = FALSE; - mem_header->data = (BYTE*)data; + mem_header->data = (uint8_t*)data; mem_header->data_length = mem_header->file_length = size_in_bytes; } else { mem_header->delete_me = TRUE; @@ -113,11 +113,11 @@ FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, i // ===================================================================== BOOL DLL_CALLCONV -FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes) { +FreeImage_AcquireMemory(FIMEMORY *stream, uint8_t **data, DWORD *size_in_bytes) { if (stream) { FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data); - *data = (BYTE*)mem_header->data; + *data = (uint8_t*)mem_header->data; *size_in_bytes = mem_header->file_length; return TRUE; } diff --git a/libs/freeimage/src/FreeImage/MultiPage.cpp b/libs/freeimage/src/FreeImage/MultiPage.cpp index ee5b481c35..c246692957 100644 --- a/libs/freeimage/src/FreeImage/MultiPage.cpp +++ b/libs/freeimage/src/FreeImage/MultiPage.cpp @@ -440,9 +440,9 @@ FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, { // read the compressed data - BYTE *compressed_data = (BYTE*)malloc(i->getSize() * sizeof(BYTE)); + uint8_t *compressed_data = (uint8_t*)malloc(i->getSize() * sizeof(uint8_t)); - header->m_cachefile.readFile((BYTE *)compressed_data, i->getReference(), i->getSize()); + header->m_cachefile.readFile((uint8_t *)compressed_data, i->getReference(), i->getSize()); // uncompress the data @@ -593,7 +593,7 @@ FreeImage_SavePageToBlock(MULTIBITMAPHEADER *header, FIBITMAP *data) { } DWORD compressed_size = 0; - BYTE *compressed_data = NULL; + uint8_t *compressed_data = NULL; // compress the bitmap data @@ -756,7 +756,7 @@ FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *page, BOOL changed) { // compress the data DWORD compressed_size = 0; - BYTE *compressed_data = NULL; + uint8_t *compressed_data = NULL; // open a memory handle FIMEMORY *hmem = FreeImage_OpenMemory(); diff --git a/libs/freeimage/src/FreeImage/NNQuantizer.cpp b/libs/freeimage/src/FreeImage/NNQuantizer.cpp index dac4a2cdec..092bad23b8 100644 --- a/libs/freeimage/src/FreeImage/NNQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/NNQuantizer.cpp @@ -337,7 +337,7 @@ void NNQuantizer::getSample(long pos, int *b, int *g, int *r) { int x = pos % img_line; int y = pos / img_line; - BYTE *bits = FreeImage_GetScanLine(dib_ptr, y) + x; + uint8_t *bits = FreeImage_GetScanLine(dib_ptr, y) + x; *b = bits[FI_RGBA_BLUE] << netbiasshift; *g = bits[FI_RGBA_GREEN] << netbiasshift; @@ -480,9 +480,9 @@ FIBITMAP* NNQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserve RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); for (int j = 0; j < netsize; j++) { - new_pal[j].rgbBlue = (BYTE)network[j][FI_RGBA_BLUE]; - new_pal[j].rgbGreen = (BYTE)network[j][FI_RGBA_GREEN]; - new_pal[j].rgbRed = (BYTE)network[j][FI_RGBA_RED]; + new_pal[j].rgbBlue = (uint8_t)network[j][FI_RGBA_BLUE]; + new_pal[j].rgbGreen = (uint8_t)network[j][FI_RGBA_GREEN]; + new_pal[j].rgbRed = (uint8_t)network[j][FI_RGBA_RED]; } inxbuild(); @@ -490,11 +490,11 @@ FIBITMAP* NNQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserve // 6) Write output image using inxsearch(b,g,r) for (WORD rows = 0; rows < img_height; rows++) { - BYTE *new_bits = FreeImage_GetScanLine(new_dib, rows); - BYTE *bits = FreeImage_GetScanLine(dib_ptr, rows); + uint8_t *new_bits = FreeImage_GetScanLine(new_dib, rows); + uint8_t *bits = FreeImage_GetScanLine(dib_ptr, rows); for (WORD cols = 0; cols < img_width; cols++) { - new_bits[cols] = (BYTE)inxsearch(bits[FI_RGBA_BLUE], bits[FI_RGBA_GREEN], bits[FI_RGBA_RED]); + new_bits[cols] = (uint8_t)inxsearch(bits[FI_RGBA_BLUE], bits[FI_RGBA_GREEN], bits[FI_RGBA_RED]); bits += 3; } diff --git a/libs/freeimage/src/FreeImage/PixelAccess.cpp b/libs/freeimage/src/FreeImage/PixelAccess.cpp index c0582a540a..185763c3ba 100644 --- a/libs/freeimage/src/FreeImage/PixelAccess.cpp +++ b/libs/freeimage/src/FreeImage/PixelAccess.cpp @@ -26,7 +26,7 @@ // ---------------------------------------------------------- -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { if(!FreeImage_HasPixels(dib)) { return NULL; @@ -35,21 +35,21 @@ FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { } BOOL DLL_CALLCONV -FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) { - BYTE shift; +FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value) { + uint8_t shift; if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 1: *value = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; break; case 4: - shift = (BYTE)((1 - x % 2) << 2); + shift = (uint8_t)((1 - x % 2) << 2); *value = (bits[x >> 1] & (0x0F << shift)) >> shift; break; case 8: @@ -71,7 +71,7 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 16: @@ -79,14 +79,14 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { bits += 2*x; WORD *pixel = (WORD *)bits; if((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) { - value->rgbBlue = (BYTE)((((*pixel & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); - value->rgbGreen = (BYTE)((((*pixel & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - value->rgbRed = (BYTE)((((*pixel & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + value->rgbBlue = (uint8_t)((((*pixel & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + value->rgbGreen = (uint8_t)((((*pixel & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + value->rgbRed = (uint8_t)((((*pixel & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); value->rgbReserved = 0; } else { - value->rgbBlue = (BYTE)((((*pixel & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); - value->rgbGreen = (BYTE)((((*pixel & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - value->rgbRed = (BYTE)((((*pixel & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + value->rgbBlue = (uint8_t)((((*pixel & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + value->rgbGreen = (uint8_t)((((*pixel & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + value->rgbRed = (uint8_t)((((*pixel & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); value->rgbReserved = 0; } break; @@ -116,21 +116,21 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { } BOOL DLL_CALLCONV -FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) { - BYTE shift; +FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value) { + uint8_t shift; if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 1: *value ? bits[x >> 3] |= (0x80 >> (x & 0x7)) : bits[x >> 3] &= (0xFF7F >> (x & 0x7)); break; case 4: - shift = (BYTE)((1 - x % 2) << 2); + shift = (uint8_t)((1 - x % 2) << 2); bits[x >> 1] &= ~(0x0F << shift); bits[x >> 1] |= ((*value & 0x0F) << shift); break; @@ -153,7 +153,7 @@ FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 16: diff --git a/libs/freeimage/src/FreeImage/PluginBMP.cpp b/libs/freeimage/src/FreeImage/PluginBMP.cpp index ceae053893..a27760a1ea 100644 --- a/libs/freeimage/src/FreeImage/PluginBMP.cpp +++ b/libs/freeimage/src/FreeImage/PluginBMP.cpp @@ -30,12 +30,12 @@ // Constants + headers // ---------------------------------------------------------- -static const BYTE RLE_COMMAND = 0; -static const BYTE RLE_ENDOFLINE = 0; -static const BYTE RLE_ENDOFBITMAP = 1; -static const BYTE RLE_DELTA = 2; +static const uint8_t RLE_COMMAND = 0; +static const uint8_t RLE_ENDOFLINE = 0; +static const uint8_t RLE_ENDOFBITMAP = 1; +static const uint8_t RLE_DELTA = 2; -static const BYTE BI_ALPHABITFIELDS = 6; // compression: Bit field (this value is valid in Windows CE .NET 4.0 and later) +static const uint8_t BI_ALPHABITFIELDS = 6; // compression: Bit field (this value is valid in Windows CE .NET 4.0 and later) typedef struct tagBITMAPINFOOS2_1X_HEADER { DWORD biSize; @@ -147,7 +147,7 @@ LoadPixelData(FreeImageIO *io, fi_handle handle, FIBITMAP *dib, int height, unsi #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB if (bit_count == 24 || bit_count == 32) { for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *pixel = FreeImage_GetScanLine(dib, y); + uint8_t *pixel = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { INPLACESWAP(pixel[0], pixel[2]); pixel += (bit_count >> 3); @@ -171,42 +171,42 @@ Load image pixels for 4-bit RLE compressed dib static BOOL LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBITMAP *dib) { int status_byte = 0; - BYTE second_byte = 0; + uint8_t second_byte = 0; int bits = 0; - BYTE *pixels = NULL; // temporary 8-bit buffer + uint8_t *pixels = NULL; // temporary 8-bit buffer try { height = abs(height); - pixels = (BYTE*)malloc(width * height * sizeof(BYTE)); + pixels = (uint8_t*)malloc(width * height * sizeof(uint8_t)); if(!pixels) throw(1); - memset(pixels, 0, width * height * sizeof(BYTE)); + memset(pixels, 0, width * height * sizeof(uint8_t)); - BYTE *q = pixels; - BYTE *end = pixels + height * width; + uint8_t *q = pixels; + uint8_t *end = pixels + height * width; for (int scanline = 0; scanline < height; ) { if (q < pixels || q >= end) { break; } - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } if (status_byte != 0) { status_byte = (int)MIN((size_t)status_byte, (size_t)(end - q)); // Encoded mode - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } for (int i = 0; i < status_byte; i++) { - *q++=(BYTE)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); + *q++=(uint8_t)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); } bits += status_byte; } else { // Escape mode - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } switch (status_byte) { @@ -228,13 +228,13 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // read the delta values - BYTE delta_x = 0; - BYTE delta_y = 0; + uint8_t delta_x = 0; + uint8_t delta_y = 0; - if(io->read_proc(&delta_x, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_x, sizeof(uint8_t), 1, handle) != 1) { throw(1); } - if(io->read_proc(&delta_y, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_y, sizeof(uint8_t), 1, handle) != 1) { throw(1); } @@ -252,17 +252,17 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI status_byte = (int)MIN((size_t)status_byte, (size_t)(end - q)); for (int i = 0; i < status_byte; i++) { if ((i & 0x01) == 0) { - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } } - *q++=(BYTE)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); + *q++=(uint8_t)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); } bits += status_byte; // Read pad byte if (((status_byte & 0x03) == 1) || ((status_byte & 0x03) == 2)) { - BYTE padding = 0; - if(io->read_proc(&padding, sizeof(BYTE), 1, handle) != 1) { + uint8_t padding = 0; + if(io->read_proc(&padding, sizeof(uint8_t), 1, handle) != 1) { throw(1); } } @@ -275,8 +275,8 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // Convert to 4-bit for(int y = 0; y < height; y++) { - const BYTE *src = (BYTE*)pixels + y * width; - BYTE *dst = FreeImage_GetScanLine(dib, y); + const uint8_t *src = (uint8_t*)pixels + y * width; + uint8_t *dst = FreeImage_GetScanLine(dib, y); BOOL hinibble = TRUE; @@ -313,19 +313,19 @@ Load image pixels for 8-bit RLE compressed dib */ static BOOL LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBITMAP *dib) { - BYTE status_byte = 0; - BYTE second_byte = 0; + uint8_t status_byte = 0; + uint8_t second_byte = 0; int scanline = 0; int bits = 0; for (;;) { - if( io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if( io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } switch (status_byte) { case RLE_COMMAND : - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -342,13 +342,13 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // read the delta values - BYTE delta_x = 0; - BYTE delta_y = 0; + uint8_t delta_x = 0; + uint8_t delta_y = 0; - if(io->read_proc(&delta_x, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_x, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } - if(io->read_proc(&delta_y, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_y, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -368,16 +368,16 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI int count = MIN((int)status_byte, width - bits); - BYTE *sline = FreeImage_GetScanLine(dib, scanline); + uint8_t *sline = FreeImage_GetScanLine(dib, scanline); - if(io->read_proc((void *)(sline + bits), sizeof(BYTE) * count, 1, handle) != 1) { + if(io->read_proc((void *)(sline + bits), sizeof(uint8_t) * count, 1, handle) != 1) { return FALSE; } // align run length to even number of bytes if ((status_byte & 1) == 1) { - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } } @@ -398,9 +398,9 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI int count = MIN((int)status_byte, width - bits); - BYTE *sline = FreeImage_GetScanLine(dib, scanline); + uint8_t *sline = FreeImage_GetScanLine(dib, scanline); - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -1008,9 +1008,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE bmp_signature1[] = { 0x42, 0x4D }; - BYTE bmp_signature2[] = { 0x42, 0x41 }; - BYTE signature[2] = { 0, 0 }; + uint8_t bmp_signature1[] = { 0x42, 0x4D }; + uint8_t bmp_signature2[] = { 0x42, 0x41 }; + uint8_t signature[2] = { 0, 0 }; io->read_proc(signature, 1, sizeof(bmp_signature1), handle); @@ -1119,8 +1119,8 @@ On return, the function will return the real size of the target buffer, which sh @return Returns the target buffer size */ static int -RLEEncodeLine(BYTE *target, BYTE *source, int size) { - BYTE buffer[256]; +RLEEncodeLine(uint8_t *target, uint8_t *source, int size) { + uint8_t buffer[256]; int buffer_size = 0; int target_pos = 0; @@ -1152,13 +1152,13 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { break; case RLE_ENDOFBITMAP : - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; target[target_pos++] = buffer[0]; break; default : target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1173,7 +1173,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { // write the continuous data - target[target_pos++] = (BYTE)((j - i) + 1); + target[target_pos++] = (uint8_t)((j - i) + 1); target[target_pos++] = source[i]; buffer_size = 0; @@ -1185,7 +1185,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { // write what we have target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1205,7 +1205,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { if (buffer_size == 254) { target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1229,13 +1229,13 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { break; case RLE_ENDOFBITMAP : - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; target[target_pos++] = buffer[0]; break; default : target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1361,7 +1361,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // write the bitmap data... if RLE compression is enable, use it if ((dst_bpp == 8) && ((flags & BMP_SAVE_RLE) == BMP_SAVE_RLE)) { - BYTE *buffer = (BYTE*)malloc(dst_pitch * 2 * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(dst_pitch * 2 * sizeof(uint8_t)); for (unsigned i = 0; i < dst_height; ++i) { int size = RLEEncodeLine(buffer, FreeImage_GetScanLine(dib, i), FreeImage_GetLine(dib)); @@ -1387,7 +1387,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void WORD pad = 0; WORD pixel; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { pixel = ((WORD *)line)[x]; SwapShort(&pixel); @@ -1408,7 +1408,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void DWORD pad = 0; FILE_BGR bgr; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { RGBTRIPLE *triple = ((RGBTRIPLE *)line)+x; bgr.b = triple->rgbtBlue; @@ -1427,7 +1427,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else if (bpp == 32) { FILE_BGRA bgra; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { RGBQUAD *quad = ((RGBQUAD *)line)+x; bgra.b = quad->rgbBlue; @@ -1446,7 +1446,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else { for (unsigned y = 0; y < dst_height; y++) { - BYTE *line = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *line = (uint8_t*)FreeImage_GetScanLine(dib, y); if (io->write_proc(line, dst_pitch, 1, handle) != 1) { return FALSE; diff --git a/libs/freeimage/src/FreeImage/PluginGIF.cpp b/libs/freeimage/src/FreeImage/PluginGIF.cpp index 8fe0422b31..b1c823bdc8 100644 --- a/libs/freeimage/src/FreeImage/PluginGIF.cpp +++ b/libs/freeimage/src/FreeImage/PluginGIF.cpp @@ -51,7 +51,7 @@ struct GIFinfo { //only really used when reading size_t global_color_table_offset; int global_color_table_size; - BYTE background_color; + uint8_t background_color; std::vector<size_t> application_extension_offsets; std::vector<size_t> comment_extension_offsets; std::vector<size_t> graphic_control_extension_offsets; @@ -79,11 +79,11 @@ public: StringTable(); ~StringTable(); void Initialize(int minCodeSize); - BYTE *FillInputBuffer(int len); + uint8_t *FillInputBuffer(int len); void CompressStart(int bpp, int width); - int CompressEnd(BYTE *buf); //0-4 bytes - bool Compress(BYTE *buf, int *len); - bool Decompress(BYTE *buf, int *len); + int CompressEnd(uint8_t *buf); //0-4 bytes + bool Compress(uint8_t *buf, int *len); + bool Decompress(uint8_t *buf, int *len); void Done(void); protected: @@ -105,7 +105,7 @@ protected: int* m_strmap; //input buffer - BYTE *m_buffer; + uint8_t *m_buffer; int m_bufferSize, m_bufferRealSize, m_bufferPos, m_bufferShift; void ClearCompressorTable(void); @@ -220,14 +220,14 @@ void StringTable::Initialize(int minCodeSize) ClearDecompressorTable(); } -BYTE *StringTable::FillInputBuffer(int len) +uint8_t *StringTable::FillInputBuffer(int len) { if( m_buffer == NULL ) { - m_buffer = new(std::nothrow) BYTE[len]; + m_buffer = new(std::nothrow) uint8_t[len]; m_bufferRealSize = len; } else if( len > m_bufferRealSize ) { delete [] m_buffer; - m_buffer = new(std::nothrow) BYTE[len]; + m_buffer = new(std::nothrow) uint8_t[len]; m_bufferRealSize = len; } m_bufferSize = len; @@ -246,7 +246,7 @@ void StringTable::CompressStart(int bpp, int width) ClearCompressorTable(); } -int StringTable::CompressEnd(BYTE *buf) +int StringTable::CompressEnd(uint8_t *buf) { int len = 0; @@ -254,7 +254,7 @@ int StringTable::CompressEnd(BYTE *buf) m_partial |= m_prefix << m_partialSize; m_partialSize += m_codeSize; while( m_partialSize >= 8 ) { - *buf++ = (BYTE)m_partial; + *buf++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; len++; @@ -264,7 +264,7 @@ int StringTable::CompressEnd(BYTE *buf) m_partial |= m_endCode << m_partialSize; m_partialSize += m_codeSize; while( m_partialSize > 0 ) { - *buf++ = (BYTE)m_partial; + *buf++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; len++; @@ -275,14 +275,14 @@ int StringTable::CompressEnd(BYTE *buf) return len; } -bool StringTable::Compress(BYTE *buf, int *len) +bool StringTable::Compress(uint8_t *buf, int *len) { if( m_bufferSize == 0 || m_done ) { return false; } int mask = (1 << m_bpp) - 1; - BYTE *bufpos = buf; + uint8_t *bufpos = buf; while( m_bufferPos < m_bufferSize ) { //get the current pixel value char ch = (char)((m_buffer[m_bufferPos] >> m_bufferShift) & mask); @@ -299,7 +299,7 @@ bool StringTable::Compress(BYTE *buf, int *len) m_partialSize += m_codeSize; //grab full bytes for the output buffer while( m_partialSize >= 8 && bufpos - buf < *len ) { - *bufpos++ = (BYTE)m_partial; + *bufpos++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; } @@ -365,13 +365,13 @@ bool StringTable::Compress(BYTE *buf, int *len) return true; } -bool StringTable::Decompress(BYTE *buf, int *len) +bool StringTable::Decompress(uint8_t *buf, int *len) { if( m_bufferSize == 0 || m_done ) { return false; } - BYTE *bufpos = buf; + uint8_t *bufpos = buf; for( ; m_bufferPos < m_bufferSize; m_bufferPos++ ) { m_partial |= (int)m_buffer[m_bufferPos] << m_partialSize; m_partialSize += 8; @@ -495,9 +495,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE GIF89a[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // ASCII code for "GIF89a" - BYTE GIF87a[] = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; // ASCII code for "GIF87a" - BYTE signature[6] = { 0, 0, 0, 0, 0, 0 }; + uint8_t GIF89a[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // ASCII code for "GIF89a" + uint8_t GIF87a[] = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; // ASCII code for "GIF87a" + uint8_t signature[6] = { 0, 0, 0, 0, 0, 0 }; io->read_proc(signature, 1, 6, handle); @@ -542,7 +542,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //Logical Screen Descriptor io->seek_proc(handle, 4, SEEK_CUR); - BYTE packed; + uint8_t packed; if( io->read_proc(&packed, 1, 1, handle) < 1 ) { throw "EOF reading Logical Screen Descriptor"; } @@ -560,7 +560,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //Scan through all the rest of the blocks, saving offsets size_t gce_offset = 0; - BYTE block = 0; + uint8_t block = 0; while( block != GIF_BLOCK_TRAILER ) { if( io->read_proc(&block, 1, 1, handle) < 1 ) { throw "EOF reading blocks"; @@ -584,7 +584,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //LZW Minimum Code Size io->seek_proc(handle, 1, SEEK_CUR); } else if( block == GIF_BLOCK_EXTENSION ) { - BYTE ext; + uint8_t ext; if( io->read_proc(&ext, 1, 1, handle) < 1 ) { throw "EOF reading extension"; } @@ -604,7 +604,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { } //Data Sub-blocks - BYTE len; + uint8_t len; if( io->read_proc(&len, 1, 1, handle) < 1 ) { throw "EOF reading sub-block"; } @@ -637,7 +637,7 @@ Close(FreeImageIO *io, fi_handle handle, void *data) { if( !info->read ) { //Trailer - BYTE b = GIF_BLOCK_TRAILER; + uint8_t b = GIF_BLOCK_TRAILER; io->write_proc(&b, 1, 1, handle); } @@ -673,7 +673,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { bool have_transparent = false, no_local_palette = false, interlaced = false; int disposal_method = GIF_DISPOSAL_LEAVE, delay_time = 0, transparent_color = 0; WORD left, top, width, height; - BYTE packed, b; + uint8_t packed, b; WORD w; //playback pages to generate what the user would see for this frame @@ -791,7 +791,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { have_transparent = false; if( FreeImage_IsTransparent(pagedib) ) { int count = FreeImage_GetTransparencyCount(pagedib); - BYTE *table = FreeImage_GetTransparencyTable(pagedib); + uint8_t *table = FreeImage_GetTransparencyTable(pagedib); for( int i = 0; i < count; i++ ) { if( table[i] == 0 ) { have_transparent = true; @@ -807,7 +807,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { break; // If data is corrupt, don't calculate in invalid scanline } scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, scanidx) + info.left; - BYTE *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1); + uint8_t *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1); for( x = 0; x < info.width; x++ ) { if( !have_transparent || *pageline != transparent_color ) { *scanline = pal[*pageline]; @@ -902,9 +902,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { } else { //its legal to have no palette, but we're going to generate *something* for( int i = 0; i < 256; i++ ) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } } @@ -915,8 +915,8 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { //Image Data Sub-blocks int x = 0, xpos = 0, y = 0, shift = 8 - bpp, mask = (1 << bpp) - 1, interlacepass = 0; - BYTE *scanline = FreeImage_GetScanLine(dib, height - 1); - BYTE buf[4096]; + uint8_t *scanline = FreeImage_GetScanLine(dib, height - 1); + uint8_t buf[4096]; io->read_proc(&b, 1, 1, handle); while( b ) { io->read_proc(stringtable->FillInputBuffer(b), b, 1, handle); @@ -1046,7 +1046,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { if( have_transparent ) { int size = 1 << bpp; if( transparent_color <= size ) { - BYTE table[256]; + uint8_t table[256]; memset(table, 0xFF, size); table[transparent_color] = 0; FreeImage_SetTransparencyTable(dib, table, size); @@ -1054,7 +1054,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { } } FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", ANIMTAG_FRAMETIME, FIDT_LONG, 1, 4, &delay_time); - b = (BYTE)disposal_method; + b = (uint8_t)disposal_method; FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", ANIMTAG_DISPOSALMETHOD, FIDT_BYTE, 1, 1, &b); delete stringtable; @@ -1082,7 +1082,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } try { - BYTE packed, b; + uint8_t packed, b; WORD w; FITAG *tag; @@ -1102,16 +1102,16 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void top = *(WORD *)FreeImage_GetTagValue(tag); } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "NoLocalPalette", FIDT_BYTE, &tag) ) { - no_local_palette = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false; + no_local_palette = *(uint8_t *)FreeImage_GetTagValue(tag) ? true : false; } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Interlaced", FIDT_BYTE, &tag) ) { - interlaced = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false; + interlaced = *(uint8_t *)FreeImage_GetTagValue(tag) ? true : false; } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", FIDT_LONG, &tag) ) { delay_time = *(LONG *)FreeImage_GetTagValue(tag); } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", FIDT_BYTE, &tag) ) { - disposal_method = *(BYTE *)FreeImage_GetTagValue(tag); + disposal_method = *(uint8_t *)FreeImage_GetTagValue(tag); } RGBQUAD *pal = FreeImage_GetPalette(dib); @@ -1186,7 +1186,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void background_color.rgbGreen == globalpalette[i].rgbGreen && background_color.rgbBlue == globalpalette[i].rgbBlue ) { - b = (BYTE)i; + b = (uint8_t)i; break; } } @@ -1240,7 +1240,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void char *value = (char *)FreeImage_GetTagValue(tag); io->write_proc((void *)"\x21\xFE", 2, 1, handle); while( length > 0 ) { - b = (BYTE)(length >= 255 ? 255 : length); + b = (uint8_t)(length >= 255 ? 255 : length); io->write_proc(&b, 1, 1, handle); io->write_proc(value, b, 1, handle); value += b; @@ -1258,7 +1258,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //Graphic Control Extension if( FreeImage_IsTransparent(dib) ) { int count = FreeImage_GetTransparencyCount(dib); - BYTE *table = FreeImage_GetTransparencyTable(dib); + uint8_t *table = FreeImage_GetTransparencyTable(dib); for( int i = 0; i < count; i++ ) { if( table[i] == 0 ) { have_transparent = true; @@ -1268,7 +1268,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } } io->write_proc((void *)"\x21\xF9\x04", 3, 1, handle); - b = (BYTE)((disposal_method << 2) & GIF_PACKED_GCE_DISPOSAL); + b = (uint8_t)((disposal_method << 2) & GIF_PACKED_GCE_DISPOSAL); if( have_transparent ) b |= GIF_PACKED_GCE_HAVETRANS; io->write_proc(&b, 1, 1, handle); //Notes about delay time for GIFs: @@ -1280,7 +1280,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void SwapShort(&w); #endif io->write_proc(&w, 2, 1, handle); - b = (BYTE)transparent_color; + b = (uint8_t)transparent_color; io->write_proc(&b, 1, 1, handle); b = 0; io->write_proc(&b, 1, 1, handle); @@ -1309,7 +1309,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //LZW Minimum Code Size - b = (BYTE)(bpp == 1 ? 2 : bpp); + b = (uint8_t)(bpp == 1 ? 2 : bpp); io->write_proc(&b, 1, 1, handle); StringTable *stringtable = new(std::nothrow) StringTable; stringtable->Initialize(b); @@ -1317,7 +1317,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //Image Data Sub-blocks int y = 0, interlacepass = 0, line = FreeImage_GetLine(dib); - BYTE buf[255], *bufptr = buf; //255 is the max sub-block length + uint8_t buf[255], *bufptr = buf; //255 is the max sub-block length int size = sizeof(buf); b = sizeof(buf); while( y < output_height ) { @@ -1343,7 +1343,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } } size = (int)(bufptr - buf); - BYTE last[4]; + uint8_t last[4]; w = (WORD)stringtable->CompressEnd(last); if( size + w >= sizeof(buf) ) { //one last full size sub-block @@ -1351,14 +1351,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void io->write_proc(buf, size, 1, handle); io->write_proc(last, sizeof(buf) - size, 1, handle); //and possibly a tiny additional sub-block - b = (BYTE)(w - (sizeof(buf) - size)); + b = (uint8_t)(w - (sizeof(buf) - size)); if( b > 0 ) { io->write_proc(&b, 1, 1, handle); io->write_proc(last + w - b, b, 1, handle); } } else { //last sub-block less than full size - b = (BYTE)(size + w); + b = (uint8_t)(size + w); io->write_proc(&b, 1, 1, handle); io->write_proc(buf, size, 1, handle); io->write_proc(last, w, 1, handle); diff --git a/libs/freeimage/src/FreeImage/PluginICO.cpp b/libs/freeimage/src/FreeImage/PluginICO.cpp index 85fc57c391..d34c49fde4 100644 --- a/libs/freeimage/src/FreeImage/PluginICO.cpp +++ b/libs/freeimage/src/FreeImage/PluginICO.cpp @@ -42,10 +42,10 @@ typedef struct tagICONHEADER { } ICONHEADER; typedef struct tagICONDIRECTORYENTRY { - BYTE bWidth; // width of the image - BYTE bHeight; // height of the image (times 2) - BYTE bColorCount; // number of colors in image (0 if >=8bpp) - BYTE bReserved; // reserved + uint8_t bWidth; // width of the image + uint8_t bHeight; // height of the image (times 2) + uint8_t bColorCount; // number of colors in image (0 if >=8bpp) + uint8_t bReserved; // reserved WORD wPlanes; // color Planes WORD wBitCount; // bits per pixel DWORD dwBytesInRes; // how many bytes in this resource? @@ -115,8 +115,8 @@ Vista icon support */ static BOOL IsPNG(FreeImageIO *io, fi_handle handle) { - BYTE png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; - BYTE signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; + uint8_t signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; long tell = io->tell_proc(handle); io->read_proc(&signature, 1, 8, handle); @@ -344,7 +344,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only) #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB if (bit_count == 24 || bit_count == 32) { for(int y = 0; y < height; y++) { - BYTE *pixel = FreeImage_GetScanLine(dib, y); + uint8_t *pixel = FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { INPLACESWAP(pixel[0], pixel[2]); pixel += (bit_count>>3); @@ -365,7 +365,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only) } int width_and = WidthBytes(width); - BYTE *line_and = (BYTE *)malloc(width_and); + uint8_t *line_and = (uint8_t *)malloc(width_and); if( line_and == NULL ) { FreeImage_Unload(dib32); @@ -498,7 +498,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { if (bit_count == 16) { WORD pixel; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { pixel = ((WORD *)line)[x]; SwapShort(&pixel); @@ -512,7 +512,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { if (bit_count == 24) { FILE_BGR bgr; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { RGBTRIPLE *triple = ((RGBTRIPLE *)line)+x; bgr.b = triple->rgbtBlue; @@ -525,7 +525,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { } else if (bit_count == 32) { FILE_BGRA bgra; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { RGBQUAD *quad = ((RGBQUAD *)line)+x; bgra.b = quad->rgbBlue; @@ -541,13 +541,13 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { #if defined(FREEIMAGE_BIGENDIAN) || FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB { #endif - BYTE *xor_mask = FreeImage_GetBits(dib); + uint8_t *xor_mask = FreeImage_GetBits(dib); io->write_proc(xor_mask, size_xor, 1, handle); #if defined(FREEIMAGE_BIGENDIAN) || FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB } #endif // AND mask - BYTE *and_mask = (BYTE*)malloc(size_and); + uint8_t *and_mask = (uint8_t*)malloc(size_and); if(!and_mask) { return FALSE; } @@ -558,7 +558,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { // create the AND mask from the alpha channel int width_and = WidthBytes(width); - BYTE *and_bits = and_mask; + uint8_t *and_bits = and_mask; // clear the mask memset(and_mask, 0, size_and); @@ -579,10 +579,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { else if(bit_count <= 8) { // create the AND mask from the transparency table - BYTE *trns = FreeImage_GetTransparencyTable(dib); + uint8_t *trns = FreeImage_GetTransparencyTable(dib); int width_and = WidthBytes(width); - BYTE *and_bits = and_mask; + uint8_t *and_bits = and_mask; // clear the mask memset(and_mask, 0, size_and); @@ -591,10 +591,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 1: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE index = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; + uint8_t index = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -608,11 +608,11 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 4: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE shift = (BYTE)((1 - x % 2) << 2); - BYTE index = (bits[x >> 1] & (0x0F << shift)) >> shift; + uint8_t shift = (uint8_t)((1 - x % 2) << 2); + uint8_t index = (bits[x >> 1] & (0x0F << shift)) >> shift; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -626,10 +626,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 8: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE index = bits[x]; + uint8_t index = bits[x]; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -723,15 +723,15 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // convert internal format to ICONDIRENTRY // take into account Vista icons whose size is 256x256 const BITMAPINFOHEADER *bmih = FreeImage_GetInfoHeader(icon_dib); - icon_list[k].bWidth = (bmih->biWidth > 255) ? 0 : (BYTE)bmih->biWidth; - icon_list[k].bHeight = (bmih->biHeight > 255) ? 0 : (BYTE)bmih->biHeight; + icon_list[k].bWidth = (bmih->biWidth > 255) ? 0 : (uint8_t)bmih->biWidth; + icon_list[k].bHeight = (bmih->biHeight > 255) ? 0 : (uint8_t)bmih->biHeight; icon_list[k].bReserved = 0; icon_list[k].wPlanes = bmih->biPlanes; icon_list[k].wBitCount = bmih->biBitCount; if( (icon_list[k].wPlanes * icon_list[k].wBitCount) >= 8 ) { icon_list[k].bColorCount = 0; } else { - icon_list[k].bColorCount = (BYTE)(1 << (icon_list[k].wPlanes * icon_list[k].wBitCount)); + icon_list[k].bColorCount = (uint8_t)(1 << (icon_list[k].wPlanes * icon_list[k].wBitCount)); } // initial guess (correct only for standard icons) icon_list[k].dwBytesInRes = CalculateImageSize(icon_dib); diff --git a/libs/freeimage/src/FreeImage/PluginJPEG.cpp b/libs/freeimage/src/FreeImage/PluginJPEG.cpp index 4dbd5d26a6..dc76574723 100644 --- a/libs/freeimage/src/FreeImage/PluginJPEG.cpp +++ b/libs/freeimage/src/FreeImage/PluginJPEG.cpp @@ -425,9 +425,9 @@ jpeg_freeimage_dst (j_compress_ptr cinfo, fi_handle outfile, FreeImageIO *io) { Read JPEG_COM marker (comment) */ static BOOL -jpeg_read_comment(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_comment(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { size_t length = datalen; - BYTE *profile = (BYTE*)dataptr; + uint8_t *profile = (uint8_t*)dataptr; // read the comment char *value = (char*)malloc((length + 1) * sizeof(char)); @@ -469,7 +469,7 @@ Handy subroutine to test whether a saved marker is an ICC profile marker. static BOOL marker_is_icc(jpeg_saved_marker_ptr marker) { // marker identifying string "ICC_PROFILE" (null-terminated) - const BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; + const uint8_t icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; if(marker->marker == ICC_MARKER) { // verify the identifying string @@ -510,7 +510,7 @@ jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *i unsigned total_length; const int MAX_SEQ_NO = 255; // sufficient since marker numbers are bytes - BYTE marker_present[MAX_SEQ_NO+1]; // 1 if marker found + uint8_t marker_present[MAX_SEQ_NO+1]; // 1 if marker found unsigned data_length[MAX_SEQ_NO+1]; // size of profile data in marker unsigned data_offset[MAX_SEQ_NO+1]; // offset for data in marker @@ -597,7 +597,7 @@ jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *i Read JPEG_APPD marker (IPTC or Adobe Photoshop profile) */ static BOOL -jpeg_read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_iptc_profile(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { return read_iptc_profile(dib, dataptr, datalen); } @@ -609,14 +609,14 @@ jpeg_read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) @return Returns TRUE if successful, FALSE otherwise */ static BOOL -jpeg_read_xmp_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_xmp_profile(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { // marker identifying string for XMP (null terminated) const char *xmp_signature = "http://ns.adobe.com/xap/1.0/"; // XMP signature is 29 bytes long const size_t xmp_signature_size = strlen(xmp_signature) + 1; size_t length = datalen; - BYTE *profile = (BYTE*)dataptr; + uint8_t *profile = (uint8_t*)dataptr; if(length <= xmp_signature_size) { // avoid reading corrupted or empty data @@ -662,23 +662,23 @@ jpeg_read_xmp_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) @return Returns TRUE if successful, FALSE otherwise */ static BOOL -jpeg_read_jfxx(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_jfxx(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { if(datalen < 6) { return FALSE; } const int id_length = 5; - const BYTE *data = dataptr + id_length; + const uint8_t *data = dataptr + id_length; unsigned remaining = datalen - id_length; - const BYTE type = *data; + const uint8_t type = *data; ++data, --remaining; switch(type) { case JFXX_TYPE_JPEG: { // load the thumbnail - FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<BYTE*>(data), remaining); + FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<uint8_t*>(data), remaining); FIBITMAP* thumbnail = FreeImage_LoadFromMemory(FIF_JPEG, hmem); FreeImage_CloseMemory(hmem); // store the thumbnail @@ -741,7 +741,7 @@ read_markers(j_decompress_ptr cinfo, FIBITMAP *dib) { } // ICC profile - BYTE *icc_profile = NULL; + uint8_t *icc_profile = NULL; unsigned icc_length = 0; if( jpeg_read_icc_profile(cinfo, &icc_profile, &icc_length) ) { @@ -772,7 +772,7 @@ jpeg_write_comment(j_compress_ptr cinfo, FIBITMAP *dib) { if(NULL != tag_value) { for(long i = 0; i < (long)strlen(tag_value); i+= MAX_BYTES_IN_MARKER) { - jpeg_write_marker(cinfo, JPEG_COM, (BYTE*)tag_value + i, MIN((long)strlen(tag_value + i), MAX_BYTES_IN_MARKER)); + jpeg_write_marker(cinfo, JPEG_COM, (uint8_t*)tag_value + i, MIN((long)strlen(tag_value + i), MAX_BYTES_IN_MARKER)); } return TRUE; } @@ -786,25 +786,25 @@ jpeg_write_comment(j_compress_ptr cinfo, FIBITMAP *dib) { static BOOL jpeg_write_icc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { // marker identifying string "ICC_PROFILE" (null-terminated) - BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; + uint8_t icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(dib); if (iccProfile->size && iccProfile->data) { // ICC_HEADER_SIZE: ICC signature is 'ICC_PROFILE' + 2 bytes - BYTE *profile = (BYTE*)malloc((iccProfile->size + ICC_HEADER_SIZE) * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc((iccProfile->size + ICC_HEADER_SIZE) * sizeof(uint8_t)); if(profile == NULL) return FALSE; memcpy(profile, icc_signature, 12); for(long i = 0; i < (long)iccProfile->size; i += MAX_DATA_BYTES_IN_MARKER) { unsigned length = MIN((long)(iccProfile->size - i), MAX_DATA_BYTES_IN_MARKER); // sequence number - profile[12] = (BYTE) ((i / MAX_DATA_BYTES_IN_MARKER) + 1); + profile[12] = (uint8_t) ((i / MAX_DATA_BYTES_IN_MARKER) + 1); // number of markers - profile[13] = (BYTE) (iccProfile->size / MAX_DATA_BYTES_IN_MARKER + 1); + profile[13] = (uint8_t) (iccProfile->size / MAX_DATA_BYTES_IN_MARKER + 1); - memcpy(profile + ICC_HEADER_SIZE, (BYTE*)iccProfile->data + i, length); + memcpy(profile + ICC_HEADER_SIZE, (uint8_t*)iccProfile->data + i, length); jpeg_write_marker(cinfo, ICC_MARKER, profile, (length + ICC_HEADER_SIZE)); } @@ -826,7 +826,7 @@ jpeg_write_iptc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { const unsigned tag_length = 26; if(FreeImage_GetMetadataCount(FIMD_IPTC, dib)) { - BYTE *profile = NULL; + uint8_t *profile = NULL; unsigned profile_size = 0; // create a binary profile @@ -836,15 +836,15 @@ jpeg_write_iptc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { for(long i = 0; i < (long)profile_size; i += 65517L) { unsigned length = MIN((long)profile_size - i, 65517L); unsigned roundup = length & 0x01; // needed for Photoshop - BYTE *iptc_profile = (BYTE*)malloc(length + roundup + tag_length); + uint8_t *iptc_profile = (uint8_t*)malloc(length + roundup + tag_length); if(iptc_profile == NULL) break; // Photoshop identification string memcpy(&iptc_profile[0], "Photoshop 3.0\x0", 14); // 8BIM segment type memcpy(&iptc_profile[14], "8BIM\x04\x04\x0\x0\x0\x0", 10); // segment size - iptc_profile[24] = (BYTE)(length >> 8); - iptc_profile[25] = (BYTE)(length & 0xFF); + iptc_profile[24] = (uint8_t)(length >> 8); + iptc_profile[25] = (uint8_t)(length & 0xFF); // segment data memcpy(&iptc_profile[tag_length], &profile[i], length); if(roundup) @@ -876,7 +876,7 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { FreeImage_GetMetadata(FIMD_XMP, dib, g_TagLib_XMPFieldName, &tag_xmp); if(tag_xmp) { - const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_xmp); + const uint8_t *tag_value = (uint8_t*)FreeImage_GetTagValue(tag_xmp); if(NULL != tag_value) { // XMP signature is 29 bytes long @@ -884,7 +884,7 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { DWORD tag_length = FreeImage_GetTagLength(tag_xmp); - BYTE *profile = (BYTE*)malloc((tag_length + xmp_header_size) * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc((tag_length + xmp_header_size) * sizeof(uint8_t)); if(profile == NULL) return FALSE; memcpy(profile, xmp_signature, xmp_header_size); @@ -911,13 +911,13 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { static BOOL jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) { // marker identifying string for Exif = "Exif\0\0" - BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; + uint8_t exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; FITAG *tag_exif = NULL; FreeImage_GetMetadata(FIMD_EXIF_RAW, dib, g_TagLib_ExifRawFieldName, &tag_exif); if(tag_exif) { - const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_exif); + const uint8_t *tag_value = (uint8_t*)FreeImage_GetTagValue(tag_exif); // verify the identifying string if(memcmp(exif_signature, tag_value, sizeof(exif_signature)) != 0) { @@ -928,7 +928,7 @@ jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) { if(NULL != tag_value) { DWORD tag_length = FreeImage_GetTagLength(tag_exif); - BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc(tag_length * sizeof(uint8_t)); if(profile == NULL) return FALSE; for(DWORD i = 0; i < tag_length; i += 65504L) { @@ -981,13 +981,13 @@ jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) { return FALSE; } - BYTE* thData = NULL; + uint8_t* thData = NULL; DWORD thSize = 0; FreeImage_AcquireMemory(stream, &thData, &thSize); - BYTE id_length = 5; //< "JFXX" - BYTE type = JFXX_TYPE_JPEG; + uint8_t id_length = 5; //< "JFXX" + uint8_t type = JFXX_TYPE_JPEG; DWORD totalsize = id_length + sizeof(type) + thSize; jpeg_write_m_header(cinfo, JPEG_APP0, totalsize); @@ -1005,10 +1005,10 @@ jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) { freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest; - BYTE* & out = dest->pub.next_output_byte; + uint8_t* & out = dest->pub.next_output_byte; size_t & bufRemain = dest->pub.free_in_buffer; - const BYTE *thData_end = thData + thSize; + const uint8_t *thData_end = thData + thSize; while(thData < thData_end) { *(out)++ = *(thData)++; @@ -1115,8 +1115,8 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE jpeg_signature[] = { 0xFF, 0xD8 }; - BYTE signature[2] = { 0, 0 }; + uint8_t jpeg_signature[] = { 0xFF, 0xD8 }; + uint8_t signature[2] = { 0, 0 }; io->read_proc(signature, 1, sizeof(jpeg_signature), handle); @@ -1252,9 +1252,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { RGBQUAD *colors = FreeImage_GetPalette(dib); for (int i = 0; i < 256; i++) { - colors[i].rgbRed = (BYTE)i; - colors[i].rgbGreen = (BYTE)i; - colors[i].rgbBlue = (BYTE)i; + colors[i].rgbRed = (uint8_t)i; + colors[i].rgbGreen = (uint8_t)i; + colors[i].rgbBlue = (uint8_t)i; } } } @@ -1309,9 +1309,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { for(unsigned x = 0; x < cinfo.output_width; x++) { WORD K = (WORD)src[3]; - dst[FI_RGBA_RED] = (BYTE)((K * src[0]) / 255); // C -> R - dst[FI_RGBA_GREEN] = (BYTE)((K * src[1]) / 255); // M -> G - dst[FI_RGBA_BLUE] = (BYTE)((K * src[2]) / 255); // Y -> B + dst[FI_RGBA_RED] = (uint8_t)((K * src[0]) / 255); // C -> R + dst[FI_RGBA_GREEN] = (uint8_t)((K * src[1]) / 255); // M -> G + dst[FI_RGBA_BLUE] = (uint8_t)((K * src[2]) / 255); // Y -> B src += 4; dst += 3; } @@ -1585,7 +1585,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void if(color_type == FIC_RGB) { // 24-bit RGB image : need to swap red and blue channels unsigned pitch = FreeImage_GetPitch(dib); - BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE)); + uint8_t *target = (uint8_t*)malloc(pitch * sizeof(uint8_t)); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } @@ -1595,7 +1595,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR // swap R and B channels - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { INPLACESWAP(target_p[0], target_p[2]); target_p += 3; @@ -1608,7 +1608,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else if(color_type == FIC_CMYK) { unsigned pitch = FreeImage_GetPitch(dib); - BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE)); + uint8_t *target = (uint8_t*)malloc(pitch * sizeof(uint8_t)); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } @@ -1617,7 +1617,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // get a copy of the scanline memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch); - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { // CMYK pixels are inverted target_p[0] = ~target_p[0]; // C @@ -1644,18 +1644,18 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void else if(color_type == FIC_PALETTE) { // 8-bit palettized images are converted to 24-bit images RGBQUAD *palette = FreeImage_GetPalette(dib); - BYTE *target = (BYTE*)malloc(cinfo.image_width * 3); + uint8_t *target = (uint8_t*)malloc(cinfo.image_width * 3); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } while (cinfo.next_scanline < cinfo.image_height) { - BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); + uint8_t *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); FreeImage_ConvertLine8To24(target, source, cinfo.image_width, palette); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR // swap R and B channels - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { INPLACESWAP(target_p[0], target_p[2]); target_p += 3; @@ -1671,18 +1671,18 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void else if(color_type == FIC_MINISWHITE) { // reverse 8-bit greyscale image, so reverse grey value on the fly unsigned i; - BYTE reverse[256]; - BYTE *target = (BYTE *)malloc(cinfo.image_width); + uint8_t reverse[256]; + uint8_t *target = (uint8_t *)malloc(cinfo.image_width); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } for(i = 0; i < 256; i++) { - reverse[i] = (BYTE)(255 - i); + reverse[i] = (uint8_t)(255 - i); } while(cinfo.next_scanline < cinfo.image_height) { - BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); + uint8_t *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); for(i = 0; i < cinfo.image_width; i++) { target[i] = reverse[ source[i] ]; } diff --git a/libs/freeimage/src/FreeImage/PluginPNG.cpp b/libs/freeimage/src/FreeImage/PluginPNG.cpp index c64f12d465..9a00c23e19 100644 --- a/libs/freeimage/src/FreeImage/PluginPNG.cpp +++ b/libs/freeimage/src/FreeImage/PluginPNG.cpp @@ -270,8 +270,8 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; - BYTE signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; + uint8_t signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; io->read_proc(&signature, 1, 8, handle); @@ -521,7 +521,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { try { // check to see if the file is in fact a PNG file - BYTE png_check[PNG_BYTES_TO_CHECK]; + uint8_t png_check[PNG_BYTES_TO_CHECK]; io->read_proc(png_check, PNG_BYTES_TO_CHECK, 1, handle); @@ -620,7 +620,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { for(int i = 0; i < palette_entries; i++) { palette[i].rgbRed = palette[i].rgbGreen = - palette[i].rgbBlue = (BYTE)((i * 255) / (palette_entries - 1)); + palette[i].rgbBlue = (uint8_t)((i * 255) / (palette_entries - 1)); } } break; @@ -648,19 +648,19 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { if((color_type == PNG_COLOR_TYPE_GRAY) && trans_color) { // single transparent color if (trans_color->gray < 256) { - BYTE table[256]; + uint8_t table[256]; memset(table, 0xFF, 256); table[trans_color->gray] = 0; FreeImage_SetTransparencyTable(dib, table, 256); } // check for a full transparency table, too else if ((trans_alpha) && (pixel_depth <= 8)) { - FreeImage_SetTransparencyTable(dib, (BYTE *)trans_alpha, num_trans); + FreeImage_SetTransparencyTable(dib, (uint8_t *)trans_alpha, num_trans); } } else if((color_type == PNG_COLOR_TYPE_PALETTE) && trans_alpha) { // transparency table - FreeImage_SetTransparencyTable(dib, (BYTE *)trans_alpha, num_trans); + FreeImage_SetTransparencyTable(dib, (uint8_t *)trans_alpha, num_trans); } } @@ -675,9 +675,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { RGBQUAD rgbBkColor; if (png_get_bKGD(png_ptr, info_ptr, &image_background)) { - rgbBkColor.rgbRed = (BYTE)image_background->red; - rgbBkColor.rgbGreen = (BYTE)image_background->green; - rgbBkColor.rgbBlue = (BYTE)image_background->blue; + rgbBkColor.rgbRed = (uint8_t)image_background->red; + rgbBkColor.rgbGreen = (uint8_t)image_background->green; + rgbBkColor.rgbBlue = (uint8_t)image_background->blue; rgbBkColor.rgbReserved = 0; FreeImage_SetBackgroundColor(dib, &rgbBkColor); @@ -1048,7 +1048,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } if ((pixel_depth == 32) && (!has_alpha_channel)) { - BYTE *buffer = (BYTE *)malloc(width * 3); + uint8_t *buffer = (uint8_t *)malloc(width * 3); // transparent conversion to 24-bit // the number of passes is either 1 for non-interlaced images, or 7 for interlaced images diff --git a/libs/freeimage/src/FreeImage/PluginWebP.cpp b/libs/freeimage/src/FreeImage/PluginWebP.cpp index 5ea29facf0..1e3a265407 100644 --- a/libs/freeimage/src/FreeImage/PluginWebP.cpp +++ b/libs/freeimage/src/FreeImage/PluginWebP.cpp @@ -86,7 +86,7 @@ data/data_size is the segment of data to write, and 'picture' is for reference (and so one can make use of picture->custom_ptr). */ static int -WebP_MemoryWriter(const BYTE *data, size_t data_size, const WebPPicture* const picture) { +WebP_MemoryWriter(const uint8_t *data, size_t data_size, const WebPPicture* const picture) { FIMEMORY *hmem = (FIMEMORY*)picture->custom_ptr; return data_size ? (FreeImage_WriteMemory(data, 1, (unsigned)data_size, hmem) == data_size) : 0; } @@ -122,9 +122,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE riff_signature[4] = { 0x52, 0x49, 0x46, 0x46 }; - BYTE webp_signature[4] = { 0x57, 0x45, 0x42, 0x50 }; - BYTE signature[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t riff_signature[4] = { 0x52, 0x49, 0x46, 0x46 }; + uint8_t webp_signature[4] = { 0x57, 0x45, 0x42, 0x50 }; + uint8_t signature[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; io->read_proc(signature, 1, 12, handle); @@ -277,14 +277,14 @@ DecodeImage(WebPData *webp_image, int flags) { // fill the dib with the decoded data - const BYTE *src_bitmap = output_buffer->u.RGBA.rgba; + const uint8_t *src_bitmap = output_buffer->u.RGBA.rgba; const unsigned src_pitch = (unsigned)output_buffer->u.RGBA.stride; switch(bpp) { case 24: for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = src_bitmap + y * src_pitch; - BYTE *dst_bits = (BYTE*)FreeImage_GetScanLine(dib, height-1-y); + const uint8_t *src_bits = src_bitmap + y * src_pitch; + uint8_t *dst_bits = (uint8_t*)FreeImage_GetScanLine(dib, height-1-y); for(unsigned x = 0; x < width; x++) { dst_bits[FI_RGBA_BLUE] = src_bits[0]; // B dst_bits[FI_RGBA_GREEN] = src_bits[1]; // G @@ -296,8 +296,8 @@ DecodeImage(WebPData *webp_image, int flags) { break; case 32: for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = src_bitmap + y * src_pitch; - BYTE *dst_bits = (BYTE*)FreeImage_GetScanLine(dib, height-1-y); + const uint8_t *src_bits = src_bitmap + y * src_pitch; + uint8_t *dst_bits = (uint8_t*)FreeImage_GetScanLine(dib, height-1-y); for(unsigned x = 0; x < width; x++) { dst_bits[FI_RGBA_BLUE] = src_bits[0]; // B dst_bits[FI_RGBA_GREEN] = src_bits[1]; // G @@ -499,7 +499,7 @@ EncodeImage(FIMEMORY *hmem, FIBITMAP *dib, int flags) { // convert dib buffer to output stream - const BYTE *bits = FreeImage_GetBits(dib); + const uint8_t *bits = FreeImage_GetBits(dib); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR switch(bpp) { @@ -582,7 +582,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void throw (1); } // store the blob into the mux - BYTE *data = NULL; + uint8_t *data = NULL; DWORD data_size = 0; FreeImage_AcquireMemory(hmem, &data, &data_size); webp_image.bytes = data; diff --git a/libs/freeimage/src/FreeImage/WuQuantizer.cpp b/libs/freeimage/src/FreeImage/WuQuantizer.cpp index 3704b2b922..c84f1c593e 100644 --- a/libs/freeimage/src/FreeImage/WuQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/WuQuantizer.cpp @@ -108,7 +108,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R if (FreeImage_GetBPP(m_dib) == 24) { for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(m_dib, y); + uint8_t *bits = FreeImage_GetScanLine(m_dib, y); for(x = 0; x < width; x++) { inr = (bits[FI_RGBA_RED] >> 3) + 1; @@ -127,7 +127,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R } } else { for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(m_dib, y); + uint8_t *bits = FreeImage_GetScanLine(m_dib, y); for(x = 0; x < width; x++) { inr = (bits[FI_RGBA_RED] >> 3) + 1; @@ -182,7 +182,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R void WuQuantizer::M3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2) { unsigned ind1, ind2; - BYTE i, r, g, b; + uint8_t i, r, g, b; LONG line, line_r, line_g, line_b; LONG area[33], area_r[33], area_g[33], area_b[33]; float line2, area2[33]; @@ -241,7 +241,7 @@ WuQuantizer::Vol( Box *cube, LONG *mmt ) { // (depending on dir) LONG -WuQuantizer::Bottom(Box *cube, BYTE dir, LONG *mmt) { +WuQuantizer::Bottom(Box *cube, uint8_t dir, LONG *mmt) { switch(dir) { case FI_RGBA_RED: @@ -272,7 +272,7 @@ WuQuantizer::Bottom(Box *cube, BYTE dir, LONG *mmt) { // r1, g1, or b1 (depending on dir) LONG -WuQuantizer::Top(Box *cube, BYTE dir, int pos, LONG *mmt) { +WuQuantizer::Top(Box *cube, uint8_t dir, int pos, LONG *mmt) { switch(dir) { case FI_RGBA_RED: @@ -325,7 +325,7 @@ WuQuantizer::Var(Box *cube) { // so we drop the minus sign and MAXIMIZE the sum of the two terms. float -WuQuantizer::Maximize(Box *cube, BYTE dir, int first, int last , int *cut, LONG whole_r, LONG whole_g, LONG whole_b, LONG whole_w) { +WuQuantizer::Maximize(Box *cube, uint8_t dir, int first, int last , int *cut, LONG whole_r, LONG whole_g, LONG whole_b, LONG whole_w) { LONG half_r, half_g, half_b, half_w; int i; float temp; @@ -375,7 +375,7 @@ WuQuantizer::Maximize(Box *cube, BYTE dir, int first, int last , int *cut, LONG bool WuQuantizer::Cut(Box *set1, Box *set2) { - BYTE dir; + uint8_t dir; int cutr, cutg, cutb; LONG whole_r = Vol(set1, mr); @@ -431,11 +431,11 @@ WuQuantizer::Cut(Box *set1, Box *set2) { void -WuQuantizer::Mark(Box *cube, int label, BYTE *tag) { +WuQuantizer::Mark(Box *cube, int label, uint8_t *tag) { for (int r = cube->r0 + 1; r <= cube->r1; r++) { for (int g = cube->g0 + 1; g <= cube->g1; g++) { for (int b = cube->b0 + 1; b <= cube->b1; b++) { - tag[INDEX(r, g, b)] = (BYTE)label; + tag[INDEX(r, g, b)] = (uint8_t)label; } } } @@ -444,7 +444,7 @@ WuQuantizer::Mark(Box *cube, int label, BYTE *tag) { // Wu Quantization algorithm FIBITMAP * WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) { - BYTE *tag = NULL; + uint8_t *tag = NULL; try { Box cube[MAXCOLOR]; @@ -512,20 +512,20 @@ WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); - tag = (BYTE*) malloc(SIZE_3D * sizeof(BYTE)); + tag = (uint8_t*) malloc(SIZE_3D * sizeof(uint8_t)); if (tag == NULL) { throw FI_MSG_ERROR_MEMORY; } - memset(tag, 0, SIZE_3D * sizeof(BYTE)); + memset(tag, 0, SIZE_3D * sizeof(uint8_t)); for (k = 0; k < PaletteSize ; k++) { Mark(&cube[k], k, tag); weight = Vol(&cube[k], wt); if (weight) { - new_pal[k].rgbRed = (BYTE)(((float)Vol(&cube[k], mr) / (float)weight) + 0.5f); - new_pal[k].rgbGreen = (BYTE)(((float)Vol(&cube[k], mg) / (float)weight) + 0.5f); - new_pal[k].rgbBlue = (BYTE)(((float)Vol(&cube[k], mb) / (float)weight) + 0.5f); + new_pal[k].rgbRed = (uint8_t)(((float)Vol(&cube[k], mr) / (float)weight) + 0.5f); + new_pal[k].rgbGreen = (uint8_t)(((float)Vol(&cube[k], mg) / (float)weight) + 0.5f); + new_pal[k].rgbBlue = (uint8_t)(((float)Vol(&cube[k], mb) / (float)weight) + 0.5f); } else { // Error: bogus box 'k' @@ -536,7 +536,7 @@ WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) int npitch = FreeImage_GetPitch(new_dib); for (unsigned y = 0; y < height; y++) { - BYTE *new_bits = FreeImage_GetBits(new_dib) + (y * npitch); + uint8_t *new_bits = FreeImage_GetBits(new_dib) + (y * npitch); for (unsigned x = 0; x < width; x++) { new_bits[x] = tag[Qadd[y*width + x]]; diff --git a/libs/freeimage/src/FreeImage/ZLibInterface.cpp b/libs/freeimage/src/FreeImage/ZLibInterface.cpp index 8a79c2590a..571777c278 100644 --- a/libs/freeimage/src/FreeImage/ZLibInterface.cpp +++ b/libs/freeimage/src/FreeImage/ZLibInterface.cpp @@ -37,7 +37,7 @@ which must be at least 0.1% larger than source_size plus 12 bytes. @see FreeImage_ZLibUncompress */ DWORD DLL_CALLCONV -FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibCompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size; int zerr = compress(target, &dest_len, source, source_size); @@ -69,7 +69,7 @@ compression library. @see FreeImage_ZLibCompress */ DWORD DLL_CALLCONV -FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibUncompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size; int zerr = uncompress(target, &dest_len, source, source_size); @@ -100,7 +100,7 @@ which must be at least 0.1% larger than source_size plus 24 bytes. @see FreeImage_ZLibCompress */ DWORD DLL_CALLCONV -FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibGZip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size - 12; DWORD crc = crc32(0L, NULL, 0); @@ -115,7 +115,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_s return 0; case Z_OK: { // patch header, setup crc and length (stolen from mod_trace_output) - BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code + uint8_t *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code crc = crc32(crc, source, source_size); memcpy(target + 4 + dest_len, &crc, 4); memcpy(target + 8 + dest_len, &source_size, 4); @@ -176,7 +176,7 @@ static int checkheader(z_stream *stream) { } DWORD DLL_CALLCONV -FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibGUnzip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { DWORD src_len = source_size; DWORD dest_len = target_size; int zerr = Z_DATA_ERROR; @@ -217,7 +217,7 @@ If source is NULL, this function returns the required initial value for the crc. @return Returns the new crc value */ DWORD DLL_CALLCONV -FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size) { +FreeImage_ZLibCRC32(DWORD crc, uint8_t *source, DWORD source_size) { return crc32(crc, source, source_size); } diff --git a/libs/freeimage/src/FreeImage/tmoColorConvert.cpp b/libs/freeimage/src/FreeImage/tmoColorConvert.cpp index 5323830bda..e71ccee2aa 100644 --- a/libs/freeimage/src/FreeImage/tmoColorConvert.cpp +++ b/libs/freeimage/src/FreeImage/tmoColorConvert.cpp @@ -137,7 +137,7 @@ ConvertInPlaceRGBFToYxy(FIBITMAP *dib) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -182,7 +182,7 @@ ConvertInPlaceYxyToRGBF(FIBITMAP *dib) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -236,7 +236,7 @@ LuminanceFromYxy(FIBITMAP *Yxy, float *maxLum, float *minLum, float *worldLum) { float max_lum = 0, min_lum = 0; double sum = 0; - BYTE *bits = (BYTE*)FreeImage_GetBits(Yxy); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Yxy); for(unsigned y = 0; y < height; y++) { const FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -278,20 +278,20 @@ ClampConvertRGBFTo24(FIBITMAP *src) { const unsigned src_pitch = FreeImage_GetPitch(src); const unsigned dst_pitch = FreeImage_GetPitch(dst); - BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; - BYTE *dst_pixel = (BYTE*)dst_bits; + uint8_t *dst_pixel = (uint8_t*)dst_bits; for(unsigned x = 0; x < width; x++) { const float red = (src_pixel[x].red > 1) ? 1 : src_pixel[x].red; const float green = (src_pixel[x].green > 1) ? 1 : src_pixel[x].green; const float blue = (src_pixel[x].blue > 1) ? 1 : src_pixel[x].blue; - dst_pixel[FI_RGBA_RED] = (BYTE)(255.0F * red + 0.5F); - dst_pixel[FI_RGBA_GREEN] = (BYTE)(255.0F * green + 0.5F); - dst_pixel[FI_RGBA_BLUE] = (BYTE)(255.0F * blue + 0.5F); + dst_pixel[FI_RGBA_RED] = (uint8_t)(255.0F * red + 0.5F); + dst_pixel[FI_RGBA_GREEN] = (uint8_t)(255.0F * green + 0.5F); + dst_pixel[FI_RGBA_BLUE] = (uint8_t)(255.0F * blue + 0.5F); dst_pixel += 3; } src_bits += src_pitch; @@ -325,8 +325,8 @@ ConvertRGBFToY(FIBITMAP *src) { const unsigned dst_pitch = FreeImage_GetPitch(dst); - BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; @@ -365,7 +365,7 @@ LuminanceFromY(FIBITMAP *dib, float *maxLum, float *minLum, float *Lav, float *L float max_lum = -1e20F, min_lum = 1e20F; double sumLum = 0, sumLogLum = 0; - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { const float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -400,7 +400,7 @@ static void findMaxMinPercentile(FIBITMAP *Y, float minPrct, float *minLum, floa std::vector<float> vY(width * height); - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { float *pixel = (float*)bits; for(x = 0; x < width; x++) { @@ -447,7 +447,7 @@ NormalizeY(FIBITMAP *Y, float minPrct, float maxPrct) { findMaxMinPercentile(Y, minPrct, &minLum, maxPrct, &maxLum); } else { maxLum = -1e20F, minLum = 1e20F; - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { const float *pixel = (float*)bits; for(x = 0; x < width; x++) { @@ -463,7 +463,7 @@ NormalizeY(FIBITMAP *Y, float minPrct, float maxPrct) { // normalize to range 0..1 const float divider = maxLum - minLum; - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { float *pixel = (float*)bits; for(x = 0; x < width; x++) { diff --git a/libs/freeimage/src/FreeImage/tmoDrago03.cpp b/libs/freeimage/src/FreeImage/tmoDrago03.cpp index de7639db61..9ddd866d95 100644 --- a/libs/freeimage/src/FreeImage/tmoDrago03.cpp +++ b/libs/freeimage/src/FreeImage/tmoDrago03.cpp @@ -94,7 +94,7 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float Normal tone mapping of every pixel further acceleration is obtained by a Padé approximation of log(x + 1) */ - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = 0; x < width; x++) { @@ -163,10 +163,10 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float /** Normal tone mapping of every pixel for the remaining right and bottom bands */ - BYTE *bits; + uint8_t *bits; // right band - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = max_width; x < width; x++) { @@ -180,7 +180,7 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float bits += pitch; } // bottom band - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = max_height; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = 0; x < max_width; x++) { @@ -226,7 +226,7 @@ REC709GammaCorrection(FIBITMAP *dib, const float gammaval) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { diff --git a/libs/freeimage/src/FreeImage/tmoFattal02.cpp b/libs/freeimage/src/FreeImage/tmoFattal02.cpp index e543fa5f3d..59cbe074ad 100644 --- a/libs/freeimage/src/FreeImage/tmoFattal02.cpp +++ b/libs/freeimage/src/FreeImage/tmoFattal02.cpp @@ -428,7 +428,7 @@ static FIBITMAP* LogLuminance(FIBITMAP *Y) { // find max & min luminance values float maxLum = -1e20F, minLum = 1e20F; - BYTE *bits = (BYTE*)FreeImage_GetBits(H); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(H); for(unsigned y = 0; y < height; y++) { const float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -443,7 +443,7 @@ static FIBITMAP* LogLuminance(FIBITMAP *Y) { // normalize to range 0..100 and take the logarithm const float scale = 100.F / (maxLum - minLum); - bits = (BYTE*)FreeImage_GetBits(H); + bits = (uint8_t*)FreeImage_GetBits(H); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -471,7 +471,7 @@ static void ExpLuminance(FIBITMAP *Y) { const unsigned height = FreeImage_GetHeight(Y); const unsigned pitch = FreeImage_GetPitch(Y); - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -644,9 +644,9 @@ FreeImage_TmoFattal02(FIBITMAP *dib, double color_saturation, double attenuation const unsigned rgb_pitch = FreeImage_GetPitch(src); const unsigned y_pitch = FreeImage_GetPitch(Yin); - BYTE *bits = (BYTE*)FreeImage_GetBits(src); - BYTE *bits_yin = (BYTE*)FreeImage_GetBits(Yin); - BYTE *bits_yout = (BYTE*)FreeImage_GetBits(Yout); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *bits_yin = (uint8_t*)FreeImage_GetBits(Yin); + uint8_t *bits_yout = (uint8_t*)FreeImage_GetBits(Yout); for(unsigned y = 0; y < height; y++) { float *Lin = (float*)bits_yin; diff --git a/libs/freeimage/src/FreeImage/tmoReinhard05.cpp b/libs/freeimage/src/FreeImage/tmoReinhard05.cpp index 34c5c67a83..33998d34b6 100644 --- a/libs/freeimage/src/FreeImage/tmoReinhard05.cpp +++ b/libs/freeimage/src/FreeImage/tmoReinhard05.cpp @@ -74,7 +74,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo int i; unsigned x, y; - BYTE *bits = NULL, *Ybits = NULL; + uint8_t *bits = NULL, *Ybits = NULL; // get statistics about the data (but only if its really needed) @@ -98,8 +98,8 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // tone map image - bits = (BYTE*)FreeImage_GetBits(dib); - Ybits = (BYTE*)FreeImage_GetBits(Y); + bits = (uint8_t*)FreeImage_GetBits(dib); + Ybits = (uint8_t*)FreeImage_GetBits(Y); if((a == 1) && (c == 0)) { // when using default values, use a fastest code @@ -131,7 +131,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo Cav[0] = Cav[1] = Cav[2] = 0; if((a != 1) && (c != 0)) { // channel averages are not needed when (a == 1) or (c == 0) - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { float *color = (float*)bits; for(x = 0; x < width; x++) { @@ -151,7 +151,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // perform tone mapping - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { const float *Y = (float*)Ybits; float *color = (float*)bits; @@ -179,7 +179,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // normalize intensities if(max_color != min_color) { - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); const float range = max_color - min_color; for(y = 0; y < height; y++) { float *color = (float*)bits; 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; } } diff --git a/libs/freeimage/src/Metadata/Exif.cpp b/libs/freeimage/src/Metadata/Exif.cpp index 8c37455b32..9fbaf3b1af 100644 --- a/libs/freeimage/src/Metadata/Exif.cpp +++ b/libs/freeimage/src/Metadata/Exif.cpp @@ -83,8 +83,8 @@ FreeImage_strnicmp(const char *s1, const char *s2, size_t len) { break; if (c1 == c2) continue; - c1 = (BYTE)tolower(c1); - c2 = (BYTE)tolower(c2); + c1 = (uint8_t)tolower(c1); + c2 = (uint8_t)tolower(c2); if (c1 != c2) break; } while (--len); @@ -102,10 +102,10 @@ ReadInt16(BOOL msb_order, const void *buffer) { short value; if(msb_order) { - value = (short)((((BYTE*) buffer)[0] << 8) | ((BYTE*) buffer)[1]); + value = (short)((((uint8_t*) buffer)[0] << 8) | ((uint8_t*) buffer)[1]); return value; } - value = (short)((((BYTE*) buffer)[1] << 8) | ((BYTE*) buffer)[0]); + value = (short)((((uint8_t*) buffer)[1] << 8) | ((uint8_t*) buffer)[0]); return value; } @@ -114,10 +114,10 @@ ReadInt32(BOOL msb_order, const void *buffer) { LONG value; if(msb_order) { - value = (LONG)((((BYTE*) buffer)[0] << 24) | (((BYTE*) buffer)[1] << 16) | (((BYTE*) buffer)[2] << 8) | (((BYTE*) buffer)[3])); + value = (LONG)((((uint8_t*) buffer)[0] << 24) | (((uint8_t*) buffer)[1] << 16) | (((uint8_t*) buffer)[2] << 8) | (((uint8_t*) buffer)[3])); return value; } - value = (LONG)((((BYTE*) buffer)[3] << 24) | (((BYTE*) buffer)[2] << 16) | (((BYTE*) buffer)[1] << 8 ) | (((BYTE*) buffer)[0])); + value = (LONG)((((uint8_t*) buffer)[3] << 24) | (((uint8_t*) buffer)[2] << 16) | (((uint8_t*) buffer)[1] << 8 ) | (((uint8_t*) buffer)[0])); return value; } @@ -126,10 +126,10 @@ ReadUint16(BOOL msb_order, const void *buffer) { WORD value; if(msb_order) { - value = (WORD) ((((BYTE*) buffer)[0] << 8) | ((BYTE*) buffer)[1]); + value = (WORD) ((((uint8_t*) buffer)[0] << 8) | ((uint8_t*) buffer)[1]); return value; } - value = (WORD) ((((BYTE*) buffer)[1] << 8) | ((BYTE*) buffer)[0]); + value = (WORD) ((((uint8_t*) buffer)[1] << 8) | ((uint8_t*) buffer)[0]); return value; } @@ -406,12 +406,12 @@ processExifTag(FIBITMAP *dib, FITAG *tag, char *pval, BOOL msb_order, TagLib::MD DWORD i; // allocate a buffer to store the tag value - BYTE *exif_value = (BYTE*)malloc(FreeImage_GetTagLength(tag) * sizeof(BYTE)); + uint8_t *exif_value = (uint8_t*)malloc(FreeImage_GetTagLength(tag) * sizeof(uint8_t)); if(NULL == exif_value) { // out of memory ... return; } - memset(exif_value, 0, FreeImage_GetTagLength(tag) * sizeof(BYTE)); + memset(exif_value, 0, FreeImage_GetTagLength(tag) * sizeof(uint8_t)); // get the tag value switch(FreeImage_GetTagType(tag)) { @@ -527,11 +527,11 @@ Process Exif directory @return Returns TRUE if sucessful, returns FALSE otherwise */ static BOOL -jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD dwLength, DWORD dwProfileOffset, BOOL msb_order, TagLib::MDMODEL starting_md_model) { +jpeg_read_exif_dir(FIBITMAP *dib, const uint8_t *tiffp, DWORD dwOffsetIfd0, DWORD dwLength, DWORD dwProfileOffset, BOOL msb_order, TagLib::MDMODEL starting_md_model) { WORD de, nde; std::stack<WORD> destack; // directory entries stack - std::stack<const BYTE*> ifdstack; // IFD stack + std::stack<const uint8_t*> ifdstack; // IFD stack std::stack<TagLib::MDMODEL> modelstack; // metadata model stack // Keep a list of already visited IFD to avoid stack overflows @@ -554,9 +554,9 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD d // set the pointer to the first IFD (0th IFD) and follow it were it leads. - const BYTE *ifd0th = (BYTE*)tiffp + (size_t)dwOffsetIfd0; + const uint8_t *ifd0th = (uint8_t*)tiffp + (size_t)dwOffsetIfd0; - const BYTE *ifdp = ifd0th; + const uint8_t *ifdp = ifd0th; de = 0; @@ -661,15 +661,15 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD d if(isIFDOffset) { DWORD sub_offset = 0; TagLib::MDMODEL next_mdmodel = md_model; - const BYTE *next_ifd = ifdp; + const uint8_t *next_ifd = ifdp; // get offset and metadata model if (FreeImage_GetTagID(tag) == TAG_MAKER_NOTE) { processMakerNote(dib, pval, msb_order, &sub_offset, &next_mdmodel); - next_ifd = (BYTE*)pval + sub_offset; + next_ifd = (uint8_t*)pval + sub_offset; } else { processIFDOffset(tag, pval, msb_order, &sub_offset, &next_mdmodel); - next_ifd = (BYTE*)tiffp + sub_offset; + next_ifd = (uint8_t*)tiffp + sub_offset; } if((sub_offset < dwLength) && (next_mdmodel != TagLib::UNKNOWN)) { @@ -725,7 +725,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD d return TRUE; //< no thumbnail } - const BYTE* const ifd1st = (BYTE*)tiffp + next_offset; + const uint8_t* const ifd1st = (uint8_t*)tiffp + next_offset; const WORD entriesCount1st = ReadUint16(msb_order, ifd1st); unsigned thCompression = 0; @@ -735,7 +735,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD d for(int e = 0; e < entriesCount1st; e++) { // point to the directory entry - const BYTE* base = DIR_ENTRY_ADDR(ifd1st, e); + const uint8_t* base = DIR_ENTRY_ADDR(ifd1st, e); // check for buffer overflow const size_t remaining = (size_t)base + 12 - (size_t)tiffp; @@ -787,9 +787,9 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, DWORD dwOffsetIfd0, DWORD d // load the thumbnail - const BYTE *thLocation = tiffp + thOffset; + const uint8_t *thLocation = tiffp + thOffset; - FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<BYTE*>(thLocation), thSize); + FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<uint8_t*>(thLocation), thSize); FIBITMAP* thumbnail = FreeImage_LoadFromMemory(FIF_JPEG, hmem); FreeImage_CloseMemory(hmem); @@ -811,15 +811,15 @@ Read and decode JPEG_APP1 marker (Exif profile) @return Returns TRUE if successful, FALSE otherwise */ BOOL -jpeg_read_exif_profile(FIBITMAP *dib, const BYTE *data, unsigned length) { +jpeg_read_exif_profile(FIBITMAP *dib, const uint8_t *data, unsigned length) { // marker identifying string for Exif = "Exif\0\0" - BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; - BYTE lsb_first[4] = { 0x49, 0x49, 0x2A, 0x00 }; // Classic TIFF signature - little-endian order - BYTE msb_first[4] = { 0x4D, 0x4D, 0x00, 0x2A }; // Classic TIFF signature - big-endian order + uint8_t exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; + uint8_t lsb_first[4] = { 0x49, 0x49, 0x2A, 0x00 }; // Classic TIFF signature - little-endian order + uint8_t msb_first[4] = { 0x4D, 0x4D, 0x00, 0x2A }; // Classic TIFF signature - big-endian order // profile size is up to 32-bit DWORD dwProfileLength = (DWORD)length; - BYTE *pbProfile = (BYTE*)data; + uint8_t *pbProfile = (uint8_t*)data; // verify the identifying string if(memcmp(exif_signature, pbProfile, sizeof(exif_signature)) == 0) { @@ -886,9 +886,9 @@ Read JPEG_APP1 marker (Exif profile) @return Returns TRUE if successful, FALSE otherwise */ BOOL -jpeg_read_exif_profile_raw(FIBITMAP *dib, const BYTE *profile, unsigned length) { +jpeg_read_exif_profile_raw(FIBITMAP *dib, const uint8_t *profile, unsigned length) { // marker identifying string for Exif = "Exif\0\0" - BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; + uint8_t exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; // verify the identifying string if(memcmp(exif_signature, profile, sizeof(exif_signature)) != 0) { @@ -930,7 +930,7 @@ Read and decode JPEG-XR Exif IFD @return Returns TRUE if successful, FALSE otherwise */ BOOL -jpegxr_read_exif_profile(FIBITMAP *dib, const BYTE *profile, unsigned length, unsigned file_offset) { +jpegxr_read_exif_profile(FIBITMAP *dib, const uint8_t *profile, unsigned length, unsigned file_offset) { // assume Little Endian order BOOL bBigEndian = FALSE; @@ -947,7 +947,7 @@ Read and decode JPEG-XR Exif-GPS IFD @return Returns TRUE if successful, FALSE otherwise */ BOOL -jpegxr_read_exif_gps_profile(FIBITMAP *dib, const BYTE *profile, unsigned length, unsigned file_offset) { +jpegxr_read_exif_gps_profile(FIBITMAP *dib, const uint8_t *profile, unsigned length, unsigned file_offset) { // assume Little Endian order BOOL bBigEndian = FALSE; @@ -1058,7 +1058,7 @@ tiff_write_ifd(FIBITMAP *dib, FREE_IMAGE_MDMODEL md_model, FIMEMORY *hmem) { DWORD ifd_offset = 0; // WORD-aligned IFD value offset - const BYTE empty_byte = 0; + const uint8_t empty_byte = 0; // start of the file const long start_of_file = FreeImage_TellMemory(hmem); @@ -1160,11 +1160,11 @@ tiff_write_ifd(FIBITMAP *dib, FREE_IMAGE_MDMODEL md_model, FIMEMORY *hmem) { // tag count DWORD tag_count = FreeImage_GetTagCount(tag); FreeImage_WriteMemory(&tag_count, 1, 4, hmem); - // tag value or offset (results are in BYTE's units) + // tag value or offset (results are in uint8_t's units) unsigned tag_length = FreeImage_GetTagLength(tag); if(tag_length <= 4) { // 4 bytes or less, write the value (left justified) - const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag); + const uint8_t *tag_value = (uint8_t*)FreeImage_GetTagValue(tag); FreeImage_WriteMemory(tag_value, 1, tag_length, hmem); for(unsigned k = tag_length; k < 4; k++) { FreeImage_WriteMemory(&empty_byte, 1, 1, hmem); @@ -1209,7 +1209,7 @@ The buffer is allocated by the function and must be freed by the caller, using ' @see tiff_write_ifd */ BOOL -tiff_get_ifd_profile(FIBITMAP *dib, FREE_IMAGE_MDMODEL md_model, BYTE **ppbProfile, unsigned *uProfileLength) { +tiff_get_ifd_profile(FIBITMAP *dib, FREE_IMAGE_MDMODEL md_model, uint8_t **ppbProfile, unsigned *uProfileLength) { FIMEMORY *hmem = NULL; try { @@ -1223,15 +1223,15 @@ tiff_get_ifd_profile(FIBITMAP *dib, FREE_IMAGE_MDMODEL md_model, BYTE **ppbProfi BOOL bResult = tiff_write_ifd(dib, md_model, hmem); if(bResult) { - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; // get a pointer to the stream buffer FreeImage_AcquireMemory(hmem, &data, &size_in_bytes); // (re-)allocate output buffer - BYTE *pbProfile = *ppbProfile; - pbProfile = (BYTE*)realloc(pbProfile, size_in_bytes); + uint8_t *pbProfile = *ppbProfile; + pbProfile = (uint8_t*)realloc(pbProfile, size_in_bytes); if(!pbProfile) { throw(1); } else { @@ -1265,13 +1265,13 @@ Read and decode PSD image resource (Exif profile) @return Returns TRUE if successful, FALSE otherwise */ BOOL -psd_read_exif_profile(FIBITMAP *dib, const BYTE *data, unsigned int length) { - BYTE lsb_first[4] = { 0x49, 0x49, 0x2A, 0x00 }; // Classic TIFF signature - little-endian order - BYTE msb_first[4] = { 0x4D, 0x4D, 0x00, 0x2A }; // Classic TIFF signature - big-endian order +psd_read_exif_profile(FIBITMAP *dib, const uint8_t *data, unsigned int length) { + uint8_t lsb_first[4] = { 0x49, 0x49, 0x2A, 0x00 }; // Classic TIFF signature - little-endian order + uint8_t msb_first[4] = { 0x4D, 0x4D, 0x00, 0x2A }; // Classic TIFF signature - big-endian order // profile size is up to 32-bit DWORD dwProfileLength = (DWORD)length; - BYTE *pbProfile = (BYTE*)data; + uint8_t *pbProfile = (uint8_t*)data; // This is an Exif profile // should contain a TIFF header with up to 2 IFDs (IFD stands for 'Image File Directory') @@ -1315,17 +1315,17 @@ Read PSD image resource (Exif profile) @return Returns TRUE if successful, FALSE otherwise */ BOOL -psd_read_exif_profile_raw(FIBITMAP *dib, const BYTE *profile, unsigned length) { +psd_read_exif_profile_raw(FIBITMAP *dib, const uint8_t *profile, unsigned length) { // marker identifying string for Exif = "Exif\0\0" // used by JPEG not PSD - BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; + uint8_t exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; if(NULL == profile || length == 0) { return FALSE; } DWORD dwProfileLength = (DWORD)length + sizeof(exif_signature); - BYTE *pbProfile = (BYTE*)malloc(dwProfileLength); + uint8_t *pbProfile = (uint8_t*)malloc(dwProfileLength); if(NULL == pbProfile) { // out of memory ... return FALSE; diff --git a/libs/freeimage/src/Metadata/FreeImageTag.cpp b/libs/freeimage/src/Metadata/FreeImageTag.cpp index a9490eb8f7..1f4f709010 100644 --- a/libs/freeimage/src/Metadata/FreeImageTag.cpp +++ b/libs/freeimage/src/Metadata/FreeImageTag.cpp @@ -51,7 +51,7 @@ FreeImage_CreateTag() { if (tag != NULL) { unsigned tag_size = sizeof(FITAGHEADER); - tag->data = (BYTE *)malloc(tag_size * sizeof(BYTE)); + tag->data = (uint8_t *)malloc(tag_size * sizeof(uint8_t)); if (tag->data != NULL) { memset(tag->data, 0, tag_size); return tag; @@ -119,15 +119,15 @@ FreeImage_CloneTag(FITAG *tag) { // tag value switch(dst_tag->type) { case FIDT_ASCII: - dst_tag->value = (BYTE*)malloc((src_tag->length + 1) * sizeof(BYTE)); + dst_tag->value = (uint8_t*)malloc((src_tag->length + 1) * sizeof(uint8_t)); if(!dst_tag->value) { throw FI_MSG_ERROR_MEMORY; } memcpy(dst_tag->value, src_tag->value, src_tag->length); - ((BYTE*)dst_tag->value)[src_tag->length] = 0; + ((uint8_t*)dst_tag->value)[src_tag->length] = 0; break; default: - dst_tag->value = (BYTE*)malloc(src_tag->length * sizeof(BYTE)); + dst_tag->value = (uint8_t*)malloc(src_tag->length * sizeof(uint8_t)); if(!dst_tag->value) { throw FI_MSG_ERROR_MEMORY; } @@ -278,7 +278,7 @@ FreeImage_SetTagValue(FITAG *tag, const void *value) { break; default: - tag_header->value = malloc(tag_header->length * sizeof(BYTE)); + tag_header->value = malloc(tag_header->length * sizeof(uint8_t)); if(!tag_header->value) { return FALSE; } diff --git a/libs/freeimage/src/Metadata/IPTC.cpp b/libs/freeimage/src/Metadata/IPTC.cpp index 612e2569fb..c8884e4b32 100644 --- a/libs/freeimage/src/Metadata/IPTC.cpp +++ b/libs/freeimage/src/Metadata/IPTC.cpp @@ -36,10 +36,10 @@ static const char* IPTC_DELIMITER = ";"; // keywords/supplemental category delim Read and decode IPTC binary data */ BOOL -read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +read_iptc_profile(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { char defaultKey[16]; size_t length = datalen; - BYTE *profile = (BYTE*)dataptr; + uint8_t *profile = (uint8_t*)dataptr; const char *JPEG_AdobeCM_Tag = "Adobe_CM"; @@ -113,8 +113,8 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { FreeImage_SetTagLength(tag, tagByteCount); // allocate a buffer to store the tag value - BYTE *iptc_value = (BYTE*)malloc((tagByteCount + 1) * sizeof(BYTE)); - memset(iptc_value, 0, (tagByteCount + 1) * sizeof(BYTE)); + uint8_t *iptc_value = (uint8_t*)malloc((tagByteCount + 1) * sizeof(uint8_t)); + memset(iptc_value, 0, (tagByteCount + 1) * sizeof(uint8_t)); // get the tag value @@ -221,13 +221,13 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { // -------------------------------------------------------------------------- -static BYTE* -append_iptc_tag(BYTE *profile, unsigned *profile_size, WORD id, DWORD length, const void *value) { - BYTE *buffer = NULL; +static uint8_t* +append_iptc_tag(uint8_t *profile, unsigned *profile_size, WORD id, DWORD length, const void *value) { + uint8_t *buffer = NULL; // calculate the new buffer size - size_t buffer_size = (5 + *profile_size + length) * sizeof(BYTE); - buffer = (BYTE*)malloc(buffer_size); + size_t buffer_size = (5 + *profile_size + length) * sizeof(uint8_t); + buffer = (uint8_t*)malloc(buffer_size); if(!buffer) return NULL; @@ -235,12 +235,12 @@ append_iptc_tag(BYTE *profile, unsigned *profile_size, WORD id, DWORD length, co buffer[0] = 0x1C; buffer[1] = 0x02; // add the tag type - buffer[2] = (BYTE)(id & 0x00FF); + buffer[2] = (uint8_t)(id & 0x00FF); // add the tag length - buffer[3] = (BYTE)(length >> 8); - buffer[4] = (BYTE)(length & 0xFF); + buffer[3] = (uint8_t)(length >> 8); + buffer[4] = (uint8_t)(length & 0xFF); // add the tag value - memcpy(buffer + 5, (BYTE*)value, length); + memcpy(buffer + 5, (uint8_t*)value, length); // append the previous profile if(NULL == profile) { *profile_size = (5 + length); @@ -259,11 +259,11 @@ Encode IPTC metadata into a binary buffer. The buffer is allocated by the function and must be freed by the caller. */ BOOL -write_iptc_profile(FIBITMAP *dib, BYTE **profile, unsigned *profile_size) { +write_iptc_profile(FIBITMAP *dib, uint8_t **profile, unsigned *profile_size) { FITAG *tag = NULL; FIMETADATA *mdhandle = NULL; - BYTE *buffer = NULL; + uint8_t *buffer = NULL; unsigned buffer_size = 0; // parse all IPTC tags and rebuild a IPTC profile diff --git a/libs/freeimage/src/Metadata/TagConversion.cpp b/libs/freeimage/src/Metadata/TagConversion.cpp index 35be9cd3c8..02743d929d 100644 --- a/libs/freeimage/src/Metadata/TagConversion.cpp +++ b/libs/freeimage/src/Metadata/TagConversion.cpp @@ -52,7 +52,7 @@ ConvertAnyTag(FITAG *tag) { switch(tag_type) { case FIDT_BYTE: // N x 8-bit unsigned integer { - BYTE *pvalue = (BYTE*)FreeImage_GetTagValue(tag); + uint8_t *pvalue = (uint8_t*)FreeImage_GetTagValue(tag); sprintf(format, "%ld", (LONG) pvalue[0]); buffer += format; @@ -336,7 +336,7 @@ ConvertExifTag(FITAG *tag) { case TAG_COMPONENTS_CONFIGURATION: { const char *componentStrings[7] = {"", "Y", "Cb", "Cr", "R", "G", "B"}; - BYTE *pvalue = (BYTE*)FreeImage_GetTagValue(tag); + uint8_t *pvalue = (uint8_t*)FreeImage_GetTagValue(tag); for(DWORD i = 0; i < MIN((DWORD)4, FreeImage_GetTagCount(tag)); i++) { int j = pvalue[i]; if(j > 0 && j < 7) @@ -522,7 +522,7 @@ ConvertExifTag(FITAG *tag) { case TAG_SCENE_TYPE: { - BYTE sceneType = *((BYTE*)FreeImage_GetTagValue(tag)); + uint8_t sceneType = *((uint8_t*)FreeImage_GetTagValue(tag)); if (sceneType == 1) { return "Directly photographed image"; } else { @@ -654,7 +654,7 @@ ConvertExifTag(FITAG *tag) { case TAG_FILE_SOURCE: { - BYTE fileSource = *((BYTE*)FreeImage_GetTagValue(tag)); + uint8_t fileSource = *((uint8_t*)FreeImage_GetTagValue(tag)); if (fileSource == 3) { return "Digital Still Camera (DSC)"; } else { @@ -885,7 +885,7 @@ ConvertExifTag(FITAG *tag) { { // first 8 bytes are used to define an ID code // we assume this is an ASCII string - const BYTE *userComment = (BYTE*)FreeImage_GetTagValue(tag); + const uint8_t *userComment = (uint8_t*)FreeImage_GetTagValue(tag); for(DWORD i = 8; i < FreeImage_GetTagLength(tag); i++) { buffer += userComment[i]; } diff --git a/libs/freeimage/src/Quantizers.h b/libs/freeimage/src/Quantizers.h index 23c4b7afca..71627361f6 100644 --- a/libs/freeimage/src/Quantizers.h +++ b/libs/freeimage/src/Quantizers.h @@ -61,13 +61,13 @@ protected: void Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int ReserveSize, RGBQUAD *ReservePalette); void M3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2); LONG Vol(Box *cube, LONG *mmt); - LONG Bottom(Box *cube, BYTE dir, LONG *mmt); - LONG Top(Box *cube, BYTE dir, int pos, LONG *mmt); + LONG Bottom(Box *cube, uint8_t dir, LONG *mmt); + LONG Top(Box *cube, uint8_t dir, int pos, LONG *mmt); float Var(Box *cube); - float Maximize(Box *cube, BYTE dir, int first, int last , int *cut, + float Maximize(Box *cube, uint8_t dir, int first, int last , int *cut, LONG whole_r, LONG whole_g, LONG whole_b, LONG whole_w); bool Cut(Box *set1, Box *set2); - void Mark(Box *cube, int label, BYTE *tag); + void Mark(Box *cube, int label, uint8_t *tag); public: // Constructor - Input parameter: DIB 24-bit to be quantized diff --git a/libs/freeimage/src/Utilities.h b/libs/freeimage/src/Utilities.h index 8afb1c918a..c783ba44e9 100644 --- a/libs/freeimage/src/Utilities.h +++ b/libs/freeimage/src/Utilities.h @@ -86,7 +86,7 @@ Allocate a FIBITMAP with no pixel data and wrap a user provided pixel buffer @return Returns the allocated FIBITMAP @see FreeImage_ConvertFromRawBitsEx */ -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_AllocateHeaderForBits(BYTE *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask); +DLL_API FIBITMAP * DLL_CALLCONV FreeImage_AllocateHeaderForBits(uint8_t *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask); /** Helper for 16-bit FIT_BITMAP @@ -267,8 +267,8 @@ CalculateUsedPaletteEntries(const unsigned bit_count) { return 0; } -inline BYTE* -CalculateScanLine(BYTE *bits, const unsigned pitch, const int scanline) { +inline uint8_t* +CalculateScanLine(uint8_t *bits, const unsigned pitch, const int scanline) { return bits ? (bits + ((size_t)pitch * scanline)) : NULL; } @@ -281,7 +281,7 @@ Fast generic assign (faster than for loop) @param bytesperpixel # of bytes per pixel */ inline void -AssignPixel(BYTE* dst, const BYTE* src, unsigned bytesperpixel) { +AssignPixel(uint8_t* dst, const uint8_t* src, unsigned bytesperpixel) { switch (bytesperpixel) { case 1: // FIT_BITMAP (8-bit) *dst = *src; @@ -450,12 +450,12 @@ A Standard Default Color Space for the Internet - sRGB. */ #define LUMA_REC709(r, g, b) (0.2126F * r + 0.7152F * g + 0.0722F * b) -#define GREY(r, g, b) (BYTE)(LUMA_REC709(r, g, b) + 0.5F) +#define GREY(r, g, b) (uint8_t)(LUMA_REC709(r, g, b) + 0.5F) /* -#define GREY(r, g, b) (BYTE)(((WORD)r * 77 + (WORD)g * 150 + (WORD)b * 29) >> 8) // .299R + .587G + .114B +#define GREY(r, g, b) (uint8_t)(((WORD)r * 77 + (WORD)g * 150 + (WORD)b * 29) >> 8) // .299R + .587G + .114B */ /* -#define GREY(r, g, b) (BYTE)(((WORD)r * 169 + (WORD)g * 256 + (WORD)b * 87) >> 9) // .33R + 0.5G + .17B +#define GREY(r, g, b) (uint8_t)(((WORD)r * 169 + (WORD)g * 256 + (WORD)b * 87) >> 9) // .33R + 0.5G + .17B */ /** diff --git a/libs/freeimage/src/main.cpp b/libs/freeimage/src/main.cpp index 07083a3702..6ad4629fef 100644 --- a/libs/freeimage/src/main.cpp +++ b/libs/freeimage/src/main.cpp @@ -37,7 +37,7 @@ EXTERN_C DLL_API void DLL_CALLCONV FreeImage_CorrectBitmap32Alpha(HBITMAP hBitma { BITMAP bmp; DWORD dwLen; - BYTE *p; + uint8_t *p; int x, y; BOOL fixIt; @@ -47,7 +47,7 @@ EXTERN_C DLL_API void DLL_CALLCONV FreeImage_CorrectBitmap32Alpha(HBITMAP hBitma return; dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); - p = (BYTE *)malloc(dwLen); + p = (uint8_t *)malloc(dwLen); if (p == nullptr) return; memset(p, 0, dwLen); @@ -56,7 +56,7 @@ EXTERN_C DLL_API void DLL_CALLCONV FreeImage_CorrectBitmap32Alpha(HBITMAP hBitma fixIt = TRUE; for (y = 0; fixIt && y < bmp.bmHeight; ++y) { - BYTE *px = p + bmp.bmWidth * 4 * y; + uint8_t *px = p + bmp.bmWidth * 4 * y; for (x = 0; fixIt && x < bmp.bmWidth; ++x) { @@ -96,14 +96,14 @@ EXTERN_C DLL_API BOOL DLL_CALLCONV FreeImage_Premultiply(HBITMAP hBitmap) int width = bmp.bmWidth; int height = bmp.bmHeight; int dwLen = width * height * 4; - BYTE *p = (BYTE *)malloc(dwLen); + uint8_t *p = (uint8_t *)malloc(dwLen); if (p != nullptr) { GetBitmapBits(hBitmap, dwLen, p); for (int y = 0; y < height; ++y) { - BYTE *px = p + width * 4 * y; + uint8_t *px = p + width * 4 * y; for (int x = 0; x < width; ++x) { - BYTE alpha = px[3]; + uint8_t alpha = px[3]; if (alpha < 255) { transp = TRUE; @@ -137,7 +137,7 @@ EXTERN_C DLL_API HBITMAP DLL_CALLCONV FreeImage_CreateHBITMAPFromDIB(FIBITMAP *i else dib = in; - BYTE *ptPixels; + uint8_t *ptPixels; BITMAPINFO *info = FreeImage_GetInfo(dib); HBITMAP hBmp = CreateDIBSection(nullptr, info, DIB_RGB_COLORS, (void **)&ptPixels, nullptr, 0); if (ptPixels != nullptr) |