mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[doc] md-plte-adjust.c: APNGs have an acTL chunk before PLTE.
FIXME: The first palette entry in APNGs appears to be unused and has low bits set...
This commit is contained in:
parent
949b32565c
commit
0e9034b86f
@ -154,6 +154,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Read the PLTE header. (Must be the first chunk after IHDR.)
|
// Read the PLTE header. (Must be the first chunk after IHDR.)
|
||||||
size = fread(&buf.plte, 1, sizeof(buf.plte), f_png);
|
size = fread(&buf.plte, 1, sizeof(buf.plte), f_png);
|
||||||
|
if (size == sizeof(buf.plte) && !memcmp(buf.plte.magic, "acTL", 4)) {
|
||||||
|
// acTL. This is an APNG.
|
||||||
|
// PLTE should be immediately after it.
|
||||||
|
// FIXME: First color seems to be unused and has low bits set...
|
||||||
|
fseek(f_png, 8+4, SEEK_CUR);
|
||||||
|
size = fread(&buf.plte, 1, sizeof(buf.plte), f_png);
|
||||||
|
}
|
||||||
if (size != sizeof(buf.plte) || memcmp(buf.plte.magic, "PLTE", 4) != 0) {
|
if (size != sizeof(buf.plte) || memcmp(buf.plte.magic, "PLTE", 4) != 0) {
|
||||||
fclose(f_png);
|
fclose(f_png);
|
||||||
fprintf(stderr, "*** ERROR reading PNG file '%s': PLTE chunk is invalid or missing.\n",
|
fprintf(stderr, "*** ERROR reading PNG file '%s': PLTE chunk is invalid or missing.\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user