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:
parent
3c3f3b1cc3
commit
ad0fe6b6f9
@ -166,15 +166,15 @@ premultiply_data(png_structp png,
|
||||
png_bytep p;
|
||||
|
||||
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;
|
||||
|
||||
if (alpha == 0) {
|
||||
w = 0;
|
||||
} else {
|
||||
png_byte red = p[0];
|
||||
png_byte green = p[1];
|
||||
png_byte blue = p[2];
|
||||
uint32_t red = p[0];
|
||||
uint32_t green = p[1];
|
||||
uint32_t blue = p[2];
|
||||
|
||||
if (alpha != 0xff) {
|
||||
red = multiply_alpha(alpha, red);
|
||||
|
Loading…
Reference in New Issue
Block a user