mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Allow fewer tRNS entries than PLTE colors (#1284)
This commit is contained in:
@@ -90,6 +90,7 @@ class Png {
|
||||
int colorType;
|
||||
int nbColors;
|
||||
png_colorp embeddedPal = nullptr;
|
||||
int nbTransparentEntries;
|
||||
png_bytep transparencyPal = nullptr;
|
||||
|
||||
[[noreturn]] static void handleError(png_structp png, char const *msg) {
|
||||
@@ -186,9 +187,8 @@ public:
|
||||
pixels.resize(static_cast<size_t>(width) * static_cast<size_t>(height));
|
||||
|
||||
if (png_get_PLTE(png, info, &embeddedPal, &nbColors) != 0) {
|
||||
int nbTransparentEntries;
|
||||
if (png_get_tRNS(png, info, &transparencyPal, &nbTransparentEntries, nullptr)) {
|
||||
assert(nbTransparentEntries == nbColors);
|
||||
assert(nbTransparentEntries <= nbColors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
0
test/gfx/trns_lt_plte.err
Normal file
0
test/gfx/trns_lt_plte.err
Normal file
1
test/gfx/trns_lt_plte.flags
Normal file
1
test/gfx/trns_lt_plte.flags
Normal file
@@ -0,0 +1 @@
|
||||
-Z
|
||||
BIN
test/gfx/trns_lt_plte.png
Normal file
BIN
test/gfx/trns_lt_plte.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 B |
Reference in New Issue
Block a user