summaryrefslogtreecommitdiff
path: root/libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp')
-rw-r--r--libs/freeimage/src/FreeImageToolkit/CopyPaste.cpp90
1 files changed, 45 insertions, 45 deletions
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) {