image-loader: Fix undefined left shift in premultiply_data
../shared/image-loader.c:184:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' Store each channel in a uint32_t instead of a byte so we compute the shift over an unsigned type.
This commit is contained in:
@@ -166,15 +166,15 @@ premultiply_data(png_structp png,
|
|||||||
png_bytep p;
|
png_bytep p;
|
||||||
|
|
||||||
for (i = 0, p = data; i < row_info->rowbytes; i += 4, p += 4) {
|
for (i = 0, p = data; i < row_info->rowbytes; i += 4, p += 4) {
|
||||||
png_byte alpha = p[3];
|
uint32_t alpha = p[3];
|
||||||
uint32_t w;
|
uint32_t w;
|
||||||
|
|
||||||
if (alpha == 0) {
|
if (alpha == 0) {
|
||||||
w = 0;
|
w = 0;
|
||||||
} else {
|
} else {
|
||||||
png_byte red = p[0];
|
uint32_t red = p[0];
|
||||||
png_byte green = p[1];
|
uint32_t green = p[1];
|
||||||
png_byte blue = p[2];
|
uint32_t blue = p[2];
|
||||||
|
|
||||||
if (alpha != 0xff) {
|
if (alpha != 0xff) {
|
||||||
red = multiply_alpha(alpha, red);
|
red = multiply_alpha(alpha, red);
|
||||||
|
|||||||
Reference in New Issue
Block a user