Skip to content

Commit

Permalink
Merge dfa2219 into facd9b0
Browse files Browse the repository at this point in the history
  • Loading branch information
jansol committed Oct 15, 2019
2 parents facd9b0 + dfa2219 commit cee4567
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libImaging/BcnDecode.c
Expand Up @@ -69,7 +69,7 @@ static rgba decode_565(UINT16 x) {
return c;
}

static void decode_bc1_color(rgba *dst, const UINT8 *src) {
static void decode_bc1_color(rgba *dst, const UINT8 *src, int separate_alpha) {
bc1_color col;
rgba p[4];
int n, cw;
Expand All @@ -84,7 +84,7 @@ static void decode_bc1_color(rgba *dst, const UINT8 *src) {
r1 = p[1].r;
g1 = p[1].g;
b1 = p[1].b;
if (col.c0 > col.c1) {
if (col.c0 > col.c1 || separate_alpha) {
p[2].r = (2*r0 + 1*r1) / 3;
p[2].g = (2*g0 + 1*g1) / 3;
p[2].b = (2*b0 + 1*b1) / 3;
Expand Down Expand Up @@ -148,12 +148,12 @@ static void decode_bc3_alpha(char *dst, const UINT8 *src, int stride, int o) {
}

static void decode_bc1_block(rgba *col, const UINT8* src) {
decode_bc1_color(col, src);
decode_bc1_color(col, src, 0);
}

static void decode_bc2_block(rgba *col, const UINT8* src) {
int n, bitI, byI, av;
decode_bc1_color(col, src + 8);
decode_bc1_color(col, src + 8, 1);
for (n = 0; n < 16; n++) {
bitI = n * 4;
byI = bitI >> 3;
Expand All @@ -164,7 +164,7 @@ static void decode_bc2_block(rgba *col, const UINT8* src) {
}

static void decode_bc3_block(rgba *col, const UINT8* src) {
decode_bc1_color(col, src + 8);
decode_bc1_color(col, src + 8, 1);
decode_bc3_alpha((char *)col, src, sizeof(col[0]), 3);
}

Expand Down

0 comments on commit cee4567

Please sign in to comment.