Rename KEEP_SAFE to DISPLAY
This commit is contained in:
parent
d7f9c81a28
commit
60243fe932
2 changed files with 6 additions and 6 deletions
|
|
@ -76,7 +76,7 @@ pub enum StripChunks {
|
||||||
None,
|
None,
|
||||||
/// Remove specific chunks
|
/// Remove specific chunks
|
||||||
Strip(IndexSet<[u8; 4]>),
|
Strip(IndexSet<[u8; 4]>),
|
||||||
/// Remove all chunks that won't affect rendering
|
/// Remove all chunks that won't affect image display
|
||||||
Safe,
|
Safe,
|
||||||
/// Remove all non-critical chunks except these
|
/// Remove all non-critical chunks except these
|
||||||
Keep(IndexSet<[u8; 4]>),
|
Keep(IndexSet<[u8; 4]>),
|
||||||
|
|
@ -85,8 +85,8 @@ pub enum StripChunks {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StripChunks {
|
impl StripChunks {
|
||||||
/// List of chunks that will be kept when using the `Safe` option
|
/// List of chunks that affect image display and will be kept when using the `Safe` option
|
||||||
pub const KEEP_SAFE: [[u8; 4]; 7] = [
|
pub const DISPLAY: [[u8; 4]; 7] = [
|
||||||
*b"cICP", *b"iCCP", *b"sRGB", *b"pHYs", *b"acTL", *b"fcTL", *b"fdAT",
|
*b"cICP", *b"iCCP", *b"sRGB", *b"pHYs", *b"acTL", *b"fcTL", *b"fdAT",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ impl StripChunks {
|
||||||
StripChunks::None => true,
|
StripChunks::None => true,
|
||||||
StripChunks::Keep(names) => names.contains(name),
|
StripChunks::Keep(names) => names.contains(name),
|
||||||
StripChunks::Strip(names) => !names.contains(name),
|
StripChunks::Strip(names) => !names.contains(name),
|
||||||
StripChunks::Safe => Self::KEEP_SAFE.contains(name),
|
StripChunks::Safe => Self::DISPLAY.contains(name),
|
||||||
StripChunks::All => false,
|
StripChunks::All => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ CAUTION: 'all' will convert APNGs to standard PNGs.
|
||||||
|
|
||||||
Note that 'bKGD', 'sBIT' and 'hIST' will be forcibly stripped if the color type or bit \
|
Note that 'bKGD', 'sBIT' and 'hIST' will be forcibly stripped if the color type or bit \
|
||||||
depth is changed, regardless of any options set.",
|
depth is changed, regardless of any options set.",
|
||||||
StripChunks::KEEP_SAFE
|
StripChunks::DISPLAY
|
||||||
.iter()
|
.iter()
|
||||||
.map(|c| String::from_utf8_lossy(c))
|
.map(|c| String::from_utf8_lossy(c))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
|
@ -632,7 +632,7 @@ fn parse_opts_into_struct(
|
||||||
})
|
})
|
||||||
.collect::<Result<IndexSet<_>, _>>()?;
|
.collect::<Result<IndexSet<_>, _>>()?;
|
||||||
if keep_display {
|
if keep_display {
|
||||||
names.extend(StripChunks::KEEP_SAFE.iter().cloned());
|
names.extend(StripChunks::DISPLAY.iter().cloned());
|
||||||
}
|
}
|
||||||
opts.strip = StripChunks::Keep(names)
|
opts.strip = StripChunks::Keep(names)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue