summaryrefslogtreecommitdiff
path: root/libs/freeimage/src/FreeImageToolkit
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-12-26 17:06:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-12-26 17:06:04 +0300
commit1039b2829a264280493ba0fa979214fe024dc70c (patch)
tree8fa6a60eb46627582c372b56a4a1d4754d6732c3 /libs/freeimage/src/FreeImageToolkit
parent62a186697df33c96dc1a6dac0f4dfc38652fb96f (diff)
WORD -> uint16_t
Diffstat (limited to 'libs/freeimage/src/FreeImageToolkit')
-rw-r--r--libs/freeimage/src/FreeImageToolkit/Background.cpp14
-rw-r--r--libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp8
-rw-r--r--libs/freeimage/src/FreeImageToolkit/Colors.cpp12
-rw-r--r--libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp12
-rw-r--r--libs/freeimage/src/FreeImageToolkit/Display.cpp12
-rw-r--r--libs/freeimage/src/FreeImageToolkit/Flip.cpp4
-rw-r--r--libs/freeimage/src/FreeImageToolkit/Resize.cpp114
7 files changed, 88 insertions, 88 deletions
diff --git a/libs/freeimage/src/FreeImageToolkit/Background.cpp b/libs/freeimage/src/FreeImageToolkit/Background.cpp
index db4e679d87..86e6088149 100644
--- a/libs/freeimage/src/FreeImageToolkit/Background.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/Background.cpp
@@ -192,9 +192,9 @@ GetAlphaBlendedColor(const RGBQUAD *bgcolor, const RGBQUAD *fgcolor, RGBQUAD *bl
uint8_t alpha = fgcolor->rgbReserved;
uint8_t not_alpha = ~alpha;
- 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->rgbRed = (uint8_t)( ((uint16_t)fgcolor->rgbRed * alpha + not_alpha * (uint16_t)bgcolor->rgbRed) >> 8 );
+ blended->rgbGreen = (uint8_t)( ((uint16_t)fgcolor->rgbGreen * alpha + not_alpha * (uint16_t)bgcolor->rgbGreen) >> 8) ;
+ blended->rgbBlue = (uint8_t)( ((uint16_t)fgcolor->rgbBlue * alpha + not_alpha * (uint16_t)bgcolor->rgbBlue) >> 8 );
blended->rgbReserved = 0xFF;
return TRUE;
@@ -309,9 +309,9 @@ FillBackgroundBitmap(FIBITMAP *dib, const RGBQUAD *color, int options) {
break;
}
case 16: {
- WORD wcolor = RGBQUAD_TO_WORD(dib, color_intl);
+ uint16_t wcolor = RGBQUAD_TO_WORD(dib, color_intl);
for (unsigned x = 0; x < width; x++) {
- ((WORD *)dst_bits)[x] = wcolor;
+ ((uint16_t *)dst_bits)[x] = wcolor;
}
break;
}
@@ -626,8 +626,8 @@ FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, cons
break;
}
case 16: {
- WORD wcolor = (type == FIT_BITMAP) ?
- RGBQUAD_TO_WORD(bitmap, ((RGBQUAD *)color)) : *((WORD *)color);
+ uint16_t wcolor = (type == FIT_BITMAP) ?
+ RGBQUAD_TO_WORD(bitmap, ((RGBQUAD *)color)) : *((uint16_t *)color);
if (wcolor != 0) {
FreeImage_FillBackground(bitmap, color, options);
}
diff --git a/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp b/libs/freeimage/src/FreeImageToolkit/ClassicRotate.cpp
index 18088debff..2ccb25739b 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 uint8_t, WORD of float.
+Parameter T can be uint8_t, uint16_t of float.
@param src Pointer to source image to rotate
@param dst Pointer to destination image
@param row Row index
@@ -160,7 +160,7 @@ HorizontalSkew(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double dWeigh
case FIT_UINT16:
case FIT_RGB16:
case FIT_RGBA16:
- HorizontalSkewT<WORD>(src, dst, row, iOffset, dWeight, bkcolor);
+ HorizontalSkewT<uint16_t>(src, dst, row, iOffset, dWeight, bkcolor);
break;
case FIT_FLOAT:
case FIT_RGBF:
@@ -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 uint8_t, WORD of float.
+Parameter T can be uint8_t, uint16_t of float.
@param src Pointer to source image to rotate
@param dst Pointer to destination image
@param col Column index
@@ -299,7 +299,7 @@ VerticalSkew(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double dWeight,
case FIT_UINT16:
case FIT_RGB16:
case FIT_RGBA16:
- VerticalSkewT<WORD>(src, dst, col, iOffset, dWeight, bkcolor);
+ VerticalSkewT<uint16_t>(src, dst, col, iOffset, dWeight, bkcolor);
break;
case FIT_FLOAT:
case FIT_RGBF:
diff --git a/libs/freeimage/src/FreeImageToolkit/Colors.cpp b/libs/freeimage/src/FreeImageToolkit/Colors.cpp
index cd67567c0c..c32f52fcc3 100644
--- a/libs/freeimage/src/FreeImageToolkit/Colors.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/Colors.cpp
@@ -109,10 +109,10 @@ FreeImage_Invert(FIBITMAP *src) {
}
else if((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(uint16_t);
for(y = 0; y < height; y++) {
- WORD *bits = (WORD*)FreeImage_GetScanLine(src, y);
+ uint16_t *bits = (uint16_t*)FreeImage_GetScanLine(src, y);
for(x = 0; x < width; x++) {
for(k = 0; k < wordspp; k++) {
bits[k] = ~bits[k];
@@ -704,12 +704,12 @@ FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolor
return result;
}
case 16: {
- WORD *src16 = (WORD *)malloc(sizeof(WORD) * count);
+ uint16_t *src16 = (uint16_t *)malloc(sizeof(uint16_t) * count);
if (NULL == src16) {
return 0;
}
- WORD *dst16 = (WORD *)malloc(sizeof(WORD) * count);
+ uint16_t *dst16 = (uint16_t *)malloc(sizeof(uint16_t) * count);
if (NULL == dst16) {
free(src16);
return 0;
@@ -722,9 +722,9 @@ FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolor
unsigned height = FreeImage_GetHeight(dib);
unsigned width = FreeImage_GetWidth(dib);
- WORD *a, *b;
+ uint16_t *a, *b;
for (unsigned y = 0; y < height; y++) {
- WORD *bits = (WORD *)FreeImage_GetScanLine(dib, y);
+ uint16_t *bits = (uint16_t *)FreeImage_GetScanLine(dib, y);
for (unsigned x = 0; x < width; x++, bits++) {
for (unsigned j = 0; j < count; j++) {
a = src16;
diff --git a/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp b/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp
index 3a9d555ba7..67c3771bcc 100644
--- a/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp
@@ -115,11 +115,11 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
// build a swap table for the closest color match from the source palette to the destination palette
for (int i = 0; i < 16; i++) {
- WORD min_diff = (WORD)-1;
+ uint16_t min_diff = (uint16_t)-1;
for (int j = 0; j < 16; j++) {
// calculates the color difference using a Manhattan distance
- WORD abs_diff = (WORD)(
+ uint16_t abs_diff = (uint16_t)(
abs(src_pal[i].rgbBlue - dst_pal[j].rgbBlue)
+ abs(src_pal[i].rgbGreen - dst_pal[j].rgbGreen)
+ abs(src_pal[i].rgbRed - dst_pal[j].rgbRed)
@@ -262,8 +262,8 @@ Combine16_555(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi
RGBTRIPLE color_s;
RGBTRIPLE color_t;
- WORD *tmp1 = (WORD *)&dst_bits[cols];
- WORD *tmp2 = (WORD *)&src_bits[cols];
+ uint16_t *tmp1 = (uint16_t *)&dst_bits[cols];
+ uint16_t *tmp2 = (uint16_t *)&src_bits[cols];
// convert 16-bit colors to 24-bit
@@ -322,8 +322,8 @@ Combine16_565(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi
RGBTRIPLE color_s;
RGBTRIPLE color_t;
- WORD *tmp1 = (WORD *)&dst_bits[cols];
- WORD *tmp2 = (WORD *)&src_bits[cols];
+ uint16_t *tmp1 = (uint16_t *)&dst_bits[cols];
+ uint16_t *tmp2 = (uint16_t *)&src_bits[cols];
// convert 16-bit colors to 24-bit
diff --git a/libs/freeimage/src/FreeImageToolkit/Display.cpp b/libs/freeimage/src/FreeImageToolkit/Display.cpp
index 5b879aa656..a6ca2ae3d4 100644
--- a/libs/freeimage/src/FreeImageToolkit/Display.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/Display.cpp
@@ -165,9 +165,9 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP
else {
// output = alpha * foreground + (1-alpha) * background
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);
+ cp_bits[FI_RGBA_BLUE] = (uint8_t)((alpha * (uint16_t)fgc.rgbBlue + not_alpha * (uint16_t)bkc.rgbBlue) >> 8);
+ cp_bits[FI_RGBA_GREEN] = (uint8_t)((alpha * (uint16_t)fgc.rgbGreen + not_alpha * (uint16_t)bkc.rgbGreen) >> 8);
+ cp_bits[FI_RGBA_RED] = (uint8_t)((alpha * (uint16_t)fgc.rgbRed + not_alpha * (uint16_t)bkc.rgbRed) >> 8);
}
fg_bits += bytespp;
@@ -217,9 +217,9 @@ FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib) {
// color * 0xFF / 0xFF = color
continue;
} else {
- 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 );
+ bits[FI_RGBA_BLUE] = (uint8_t)( (alpha * (uint16_t)bits[FI_RGBA_BLUE] + 127) / 255 );
+ bits[FI_RGBA_GREEN] = (uint8_t)( (alpha * (uint16_t)bits[FI_RGBA_GREEN] + 127) / 255 );
+ bits[FI_RGBA_RED] = (uint8_t)( (alpha * (uint16_t)bits[FI_RGBA_RED] + 127) / 255 );
}
}
}
diff --git a/libs/freeimage/src/FreeImageToolkit/Flip.cpp b/libs/freeimage/src/FreeImageToolkit/Flip.cpp
index 3f7bcf972a..52a43d2f24 100644
--- a/libs/freeimage/src/FreeImageToolkit/Flip.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/Flip.cpp
@@ -86,8 +86,8 @@ FreeImage_FlipHorizontal(FIBITMAP *src) {
case 16:
{
- WORD *dst_data = (WORD*) bits;
- WORD *src_data = (WORD*) (new_bits + line - bytespp);
+ uint16_t *dst_data = (uint16_t*) bits;
+ uint16_t *src_data = (uint16_t*) (new_bits + line - bytespp);
for(unsigned c = 0; c < width; c++) {
*dst_data++ = *src_data--;
}
diff --git a/libs/freeimage/src/FreeImageToolkit/Resize.cpp b/libs/freeimage/src/FreeImageToolkit/Resize.cpp
index 9781be9788..7eac266cd0 100644
--- a/libs/freeimage/src/FreeImageToolkit/Resize.cpp
+++ b/libs/freeimage/src/FreeImageToolkit/Resize.cpp
@@ -981,14 +981,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
// image has 565 format
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);
+ const uint16_t * const src_bits = (uint16_t *)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(uint16_t);
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 WORD *pixel = src_bits + iLeft;
+ const uint16_t *pixel = src_bits + iLeft;
double r = 0, g = 0, b = 0;
// for(i = iLeft to iRight)
@@ -1013,14 +1013,14 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
// image has 555 format
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;
+ const uint16_t * const src_bits = (uint16_t *)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 WORD *pixel = src_bits + iLeft;
+ const uint16_t *pixel = src_bits + iLeft;
double r = 0, g = 0, b = 0;
// for(i = iLeft to iRight)
@@ -1125,18 +1125,18 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
case FIT_UINT16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(uint16_t);
for (unsigned y = 0; y < height; y++) {
// scale each row
- const WORD *src_bits = (WORD*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(WORD);
- WORD *dst_bits = (WORD*)FreeImage_GetScanLine(dst, y);
+ const uint16_t *src_bits = (uint16_t*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(uint16_t);
+ uint16_t *dst_bits = (uint16_t*)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 WORD *pixel = src_bits + iLeft * wordspp;
+ const uint16_t *pixel = src_bits + iLeft * wordspp;
double value = 0;
// for(i = iLeft to iRight)
@@ -1149,7 +1149,7 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(value + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(value + 0.5), 0, 0xFFFF);
dst_bits += wordspp;
}
}
@@ -1159,18 +1159,18 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
case FIT_RGB16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(uint16_t);
for (unsigned y = 0; y < height; y++) {
// scale each row
- const WORD *src_bits = (WORD*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(WORD);
- WORD *dst_bits = (WORD*)FreeImage_GetScanLine(dst, y);
+ const uint16_t *src_bits = (uint16_t*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(uint16_t);
+ uint16_t *dst_bits = (uint16_t*)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 WORD *pixel = src_bits + iLeft * wordspp;
+ const uint16_t *pixel = src_bits + iLeft * wordspp;
double r = 0, g = 0, b = 0;
// for(i = iLeft to iRight)
@@ -1185,9 +1185,9 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
- dst_bits[1] = (WORD)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
- dst_bits[2] = (WORD)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
+ dst_bits[1] = (uint16_t)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
+ dst_bits[2] = (uint16_t)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
dst_bits += wordspp;
}
}
@@ -1197,18 +1197,18 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
case FIT_RGBA16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / src_width) / sizeof(uint16_t);
for (unsigned y = 0; y < height; y++) {
// scale each row
- const WORD *src_bits = (WORD*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(WORD);
- WORD *dst_bits = (WORD*)FreeImage_GetScanLine(dst, y);
+ const uint16_t *src_bits = (uint16_t*)FreeImage_GetScanLine(src, y + src_offset_y) + src_offset_x / sizeof(uint16_t);
+ uint16_t *dst_bits = (uint16_t*)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 WORD *pixel = src_bits + iLeft * wordspp;
+ const uint16_t *pixel = src_bits + iLeft * wordspp;
double r = 0, g = 0, b = 0, a = 0;
// for(i = iLeft to iRight)
@@ -1224,10 +1224,10 @@ void CResizeEngine::horizontalFilter(FIBITMAP *const src, unsigned height, unsig
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
- dst_bits[1] = (WORD)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
- dst_bits[2] = (WORD)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
- dst_bits[3] = (WORD)CLAMP<int>((int)(a + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
+ dst_bits[1] = (uint16_t)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
+ dst_bits[2] = (uint16_t)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
+ dst_bits[3] = (uint16_t)CLAMP<int>((int)(a + 0.5), 0, 0xFFFF);
dst_bits += wordspp;
}
}
@@ -1781,8 +1781,8 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
case 16:
{
// transparently convert the 16-bit non-transparent image to 24 bpp
- const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(WORD);
- const WORD *const src_base = (WORD *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x;
+ const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(uint16_t);
+ const uint16_t *const src_base = (uint16_t *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x;
if (IS_FORMAT_RGB565(src)) {
// image has 565 format
@@ -1795,7 +1795,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 WORD *src_bits = src_base + iLeft * src_pitch + x;
+ const uint16_t *src_bits = src_base + iLeft * src_pitch + x;
double r = 0, g = 0, b = 0;
for (unsigned i = 0; i < iLimit; i++) {
@@ -1826,7 +1826,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 WORD *src_bits = src_base + iLeft * src_pitch + x;
+ const uint16_t *src_bits = src_base + iLeft * src_pitch + x;
double r = 0, g = 0, b = 0;
for (unsigned i = 0; i < iLimit; i++) {
@@ -1936,25 +1936,25 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
case FIT_UINT16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(uint16_t);
- const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(WORD);
- WORD *const dst_base = (WORD *)FreeImage_GetBits(dst);
+ const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(uint16_t);
+ uint16_t *const dst_base = (uint16_t *)FreeImage_GetBits(dst);
- const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(WORD);
- const WORD *const src_base = (WORD *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
+ const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(uint16_t);
+ const uint16_t *const src_base = (uint16_t *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
for (unsigned x = 0; x < width; x++) {
// work on column x in dst
const unsigned index = x * wordspp; // pixel index
- WORD *dst_bits = dst_base + index;
+ uint16_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 WORD *src_bits = src_base + iLeft * src_pitch + index;
+ const uint16_t *src_bits = src_base + iLeft * src_pitch + index;
double value = 0;
for (unsigned i = 0; i < iLimit; i++) {
@@ -1966,7 +1966,7 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(value + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(value + 0.5), 0, 0xFFFF);
dst_bits += dst_pitch;
}
@@ -1977,25 +1977,25 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
case FIT_RGB16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(uint16_t);
- const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(WORD);
- WORD *const dst_base = (WORD *)FreeImage_GetBits(dst);
+ const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(uint16_t);
+ uint16_t *const dst_base = (uint16_t *)FreeImage_GetBits(dst);
- const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(WORD);
- const WORD *const src_base = (WORD *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
+ const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(uint16_t);
+ const uint16_t *const src_base = (uint16_t *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
for (unsigned x = 0; x < width; x++) {
// work on column x in dst
const unsigned index = x * wordspp; // pixel index
- WORD *dst_bits = dst_base + index;
+ uint16_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 WORD *src_bits = src_base + iLeft * src_pitch + index;
+ const uint16_t *src_bits = src_base + iLeft * src_pitch + index;
double r = 0, g = 0, b = 0;
for (unsigned i = 0; i < iLimit; i++) {
@@ -2010,9 +2010,9 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
- dst_bits[1] = (WORD)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
- dst_bits[2] = (WORD)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
+ dst_bits[1] = (uint16_t)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
+ dst_bits[2] = (uint16_t)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
dst_bits += dst_pitch;
}
@@ -2023,25 +2023,25 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
case FIT_RGBA16:
{
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
- const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD);
+ const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(uint16_t);
- const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(WORD);
- WORD *const dst_base = (WORD *)FreeImage_GetBits(dst);
+ const unsigned dst_pitch = FreeImage_GetPitch(dst) / sizeof(uint16_t);
+ uint16_t *const dst_base = (uint16_t *)FreeImage_GetBits(dst);
- const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(WORD);
- const WORD *const src_base = (WORD *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
+ const unsigned src_pitch = FreeImage_GetPitch(src) / sizeof(uint16_t);
+ const uint16_t *const src_base = (uint16_t *)FreeImage_GetBits(src) + src_offset_y * src_pitch + src_offset_x * wordspp;
for (unsigned x = 0; x < width; x++) {
// work on column x in dst
const unsigned index = x * wordspp; // pixel index
- WORD *dst_bits = dst_base + index;
+ uint16_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 WORD *src_bits = src_base + iLeft * src_pitch + index;
+ const uint16_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++) {
@@ -2057,10 +2057,10 @@ void CResizeEngine::verticalFilter(FIBITMAP *const src, unsigned width, unsigned
}
// clamp and place result in destination pixel
- dst_bits[0] = (WORD)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
- dst_bits[1] = (WORD)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
- dst_bits[2] = (WORD)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
- dst_bits[3] = (WORD)CLAMP<int>((int)(a + 0.5), 0, 0xFFFF);
+ dst_bits[0] = (uint16_t)CLAMP<int>((int)(r + 0.5), 0, 0xFFFF);
+ dst_bits[1] = (uint16_t)CLAMP<int>((int)(g + 0.5), 0, 0xFFFF);
+ dst_bits[2] = (uint16_t)CLAMP<int>((int)(b + 0.5), 0, 0xFFFF);
+ dst_bits[3] = (uint16_t)CLAMP<int>((int)(a + 0.5), 0, 0xFFFF);
dst_bits += dst_pitch;
}