diff options
author | Bastien Nocera <hadess@hadess.net> | 2016-12-29 14:36:45 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-12-29 14:36:45 +0100 |
commit | 97529aaad997dc397d69fbd0aed2605c9cf7ba5a (patch) | |
tree | a1e8266a4119358e764e8d4ab1019dff45bf5a10 | |
parent | d8ea84789810477aa130b2e5f7c8e27a5e3587ab (diff) | |
download | gdk-pixbuf-97529aaad997dc397d69fbd0aed2605c9cf7ba5a.tar.gz |
ico: Fix uninitialised alpha values
As we always create a GdkPixbuf with alpha, even if the original file
doesn't have an alpha channel, or a mask, make sure to set the alpha
pixel value in all cases, if only to have it overridden if there is a
mask present.
This makes it possible to use the reference test without having
differing alpha values.
-rw-r--r-- | gdk-pixbuf/io-ico.c | 7 | ||||
-rw-r--r-- | tests/test-images/reftests/squares.ico | bin | 0 -> 6926 bytes | |||
-rw-r--r-- | tests/test-images/reftests/squares.ico.ref.png | bin | 0 -> 259 bytes |
3 files changed, 6 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c index e6c1299fa..9448619c8 100644 --- a/gdk-pixbuf/io-ico.c +++ b/gdk-pixbuf/io-ico.c @@ -659,6 +659,7 @@ static void OneLine24(struct ico_progressive_state *context) Pixels[X * 4 + 0] = context->LineBuf[X * 3 + 2]; Pixels[X * 4 + 1] = context->LineBuf[X * 3 + 1]; Pixels[X * 4 + 2] = context->LineBuf[X * 3 + 0]; + Pixels[X * 4 + 3] = 0xff; X++; } @@ -699,7 +700,7 @@ OneLine16 (struct ico_progressive_state *context) *pixels++ = (r << 3) | (r >> 2); *pixels++ = (g << 3) | (g >> 2); *pixels++ = (b << 3) | (b >> 2); - pixels++; /* skip alpha channel */ + *pixels++ = 0xff; } } @@ -726,6 +727,7 @@ static void OneLine8(struct ico_progressive_state *context) context->HeaderBuf[4 * context->LineBuf[X] + INFOHEADER_SIZE + 1 +context->DIBoffset]; Pixels[X * 4 + 2] = context->HeaderBuf[4 * context->LineBuf[X] + INFOHEADER_SIZE +context->DIBoffset]; + Pixels[X * 4 + 3] = 0xff; X++; } } @@ -755,6 +757,7 @@ static void OneLine4(struct ico_progressive_state *context) context->HeaderBuf[4 * (Pix>>4) + INFOHEADER_SIZE + 1 +context->DIBoffset]; Pixels[X * 4 + 2] = context->HeaderBuf[4 * (Pix>>4) + INFOHEADER_SIZE + context->DIBoffset]; + Pixels[X * 4 + 3] = 0xff; X++; if (X<context->Header.width) { /* Handle the other 4 bit pixel only when there is one */ @@ -764,6 +767,7 @@ static void OneLine4(struct ico_progressive_state *context) context->HeaderBuf[4 * (Pix&15) + INFOHEADER_SIZE + 1 + context->DIBoffset]; Pixels[X * 4 + 2] = context->HeaderBuf[4 * (Pix&15) + INFOHEADER_SIZE + context->DIBoffset]; + Pixels[X * 4 + 3] = 0xff; X++; } } @@ -793,6 +797,7 @@ static void OneLine1(struct ico_progressive_state *context) Pixels[X * 4 + 0] = Bit*255; Pixels[X * 4 + 1] = Bit*255; Pixels[X * 4 + 2] = Bit*255; + Pixels[X * 4 + 3] = 0xff; X++; } } diff --git a/tests/test-images/reftests/squares.ico b/tests/test-images/reftests/squares.ico Binary files differnew file mode 100644 index 000000000..6bda81b37 --- /dev/null +++ b/tests/test-images/reftests/squares.ico diff --git a/tests/test-images/reftests/squares.ico.ref.png b/tests/test-images/reftests/squares.ico.ref.png Binary files differnew file mode 100644 index 000000000..c0f603c0f --- /dev/null +++ b/tests/test-images/reftests/squares.ico.ref.png |