mirror of
https://github.com/typst/typst
synced 2025-08-10 13:17:55 +08:00
Also hash ICC profile
This commit is contained in:
parent
1e641be5b2
commit
8f884f9f1d
@ -170,16 +170,17 @@ impl RasterImage {
|
||||
}
|
||||
|
||||
/// Access the ICC profile, if any.
|
||||
pub fn icc(&self) -> Option<&[u8]> {
|
||||
self.0.icc.as_deref()
|
||||
pub fn icc(&self) -> Option<&Bytes> {
|
||||
self.0.icc.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Repr {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
// The image is fully defined by data and format.
|
||||
// The image is fully defined by data, format, and ICC profile.
|
||||
self.data.hash(state);
|
||||
self.format.hash(state);
|
||||
self.icc.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ fn encode_raster_image(image: &RasterImage, interpolate: bool) -> EncodedImage {
|
||||
(Filter::FlateDecode, data, bits_per_component)
|
||||
};
|
||||
|
||||
let compressed_icc = image.icc().map(deflate);
|
||||
let compressed_icc = image.icc().map(|data| deflate(data));
|
||||
let alpha = dynamic.color().has_alpha().then(|| encode_alpha(dynamic));
|
||||
|
||||
EncodedImage::Raster {
|
||||
|
Loading…
x
Reference in New Issue
Block a user