Commit 3759ca8 1 parent 90ceef9 commit 3759ca8 Copy full SHA for 3759ca8
File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -186,9 +186,12 @@ impl PngData {
186
186
// Ancillary chunks - split into those that come before IDAT and those that come after
187
187
let mut aux_split = self . aux_chunks . split ( |c| & c. name == b"IDAT" ) ;
188
188
let aux_pre = aux_split. next ( ) . unwrap ( ) ;
189
+ // Many chunks need to be before PLTE, so write all except those that explicitly need to be after
190
+ // Note: the PNG spec does not say that fcTL needs to be after PLTE, but some decoders expect
191
+ // that (see issue #625)
189
192
for chunk in aux_pre
190
193
. iter ( )
191
- . filter ( |c| !( & c. name == b"bKGD" || & c . name == b"hIST" || & c . name == b"tRNS " ) )
194
+ . filter ( |c| !matches ! ( & c. name, b"bKGD" | b"hIST" | b"tRNS" | b"fcTL " ) )
192
195
{
193
196
write_png_block ( & chunk. name , & chunk. data , & mut output) ;
194
197
}
@@ -223,7 +226,7 @@ impl PngData {
223
226
// Special ancillary chunks that need to come after PLTE but before IDAT
224
227
for chunk in aux_pre
225
228
. iter ( )
226
- . filter ( |c| & c. name == b"bKGD" || & c . name == b"hIST" || & c . name == b"tRNS" )
229
+ . filter ( |c| matches ! ( & c. name, b"bKGD" | b"hIST" | b"tRNS" | b"fcTL" ) )
227
230
{
228
231
write_png_block ( & chunk. name , & chunk. data , & mut output) ;
229
232
}
You can’t perform that action at this time.
0 commit comments