mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Merge pull request #7413 from radarhere/bc5s
This commit is contained in:
commit
09605ff48e
Binary file not shown.
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
|
@ -850,10 +850,12 @@ decode_bcn(
|
||||||
DECODE_LOOP(3, 16, rgba);
|
DECODE_LOOP(3, 16, rgba);
|
||||||
DECODE_LOOP(4, 8, lum);
|
DECODE_LOOP(4, 8, lum);
|
||||||
case 5:
|
case 5:
|
||||||
|
{
|
||||||
|
int sign = strcmp(pixel_format, "BC5S") == 0 ? 1 : 0;
|
||||||
while (bytes >= 16) {
|
while (bytes >= 16) {
|
||||||
rgba col[16];
|
rgba col[16];
|
||||||
memset(col, 0, 16 * sizeof(col[0]));
|
memset(col, sign ? 128 : 0, 16 * sizeof(col[0]));
|
||||||
decode_bc5_block(col, ptr, strcmp(pixel_format, "BC5S") == 0 ? 1 : 0);
|
decode_bc5_block(col, ptr, sign);
|
||||||
put_block(im, state, (const char *)col, sizeof(col[0]), C);
|
put_block(im, state, (const char *)col, sizeof(col[0]), C);
|
||||||
ptr += 16;
|
ptr += 16;
|
||||||
bytes -= 16;
|
bytes -= 16;
|
||||||
|
@ -862,10 +864,13 @@ decode_bcn(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 6:
|
case 6:
|
||||||
|
{
|
||||||
|
int sign = strcmp(pixel_format, "BC6HS") == 0 ? 1 : 0;
|
||||||
while (bytes >= 16) {
|
while (bytes >= 16) {
|
||||||
rgba col[16];
|
rgba col[16];
|
||||||
decode_bc6_block(col, ptr, strcmp(pixel_format, "BC6HS") == 0 ? 1 : 0);
|
decode_bc6_block(col, ptr, sign);
|
||||||
put_block(im, state, (const char *)col, sizeof(col[0]), C);
|
put_block(im, state, (const char *)col, sizeof(col[0]), C);
|
||||||
ptr += 16;
|
ptr += 16;
|
||||||
bytes -= 16;
|
bytes -= 16;
|
||||||
|
@ -874,6 +879,7 @@ decode_bcn(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
DECODE_LOOP(7, 16, rgba);
|
DECODE_LOOP(7, 16, rgba);
|
||||||
#undef DECODE_LOOP
|
#undef DECODE_LOOP
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user