mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
style: cargo fmt
This commit is contained in:
1 parent
9331058ee3
commit
01c63a0e9e
2 files changed
+6
-3
No files matched your search
@@ -600,8 +600,7 @@ fn transparent_tiff_without_channels_keeps_image_alpha() {
|
||||
assert!(img.layout().has_alpha(), "{layers}");
|
||||
assert!(img.meta.extra_samples.is_empty(), "{layers}");
|
||||
let parsed = craft_tiff::Tiff::parse(&r.bytes).unwrap();
|
||||
let extra: Vec<u16> =
|
||||
parsed.ifds[0].value(craft_tiff::tags::EXTRA_SAMPLES).unwrap().to_u64_vec().into_iter().map(|x| x as u16).collect();
|
||||
let extra: Vec<u16> = parsed.ifds[0].value(craft_tiff::tags::EXTRA_SAMPLES).unwrap().to_u64_vec().into_iter().map(|x| x as u16).collect();
|
||||
assert_eq!(extra, vec![2], "{layers}");
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("Save Transparency")), "{layers}: {:?}", r.warnings);
|
||||
if layers {
|
||||
|
||||
@@ -34,7 +34,11 @@ fn save(doc: &Document, layers: bool, transparency: Option<bool>) -> ExportResul
|
||||
|
||||
fn extra_samples_tag(bytes: &[u8]) -> Vec<u16> {
|
||||
let tiff = craft_tiff::Tiff::parse(bytes).unwrap();
|
||||
tiff.ifds.first().and_then(|ifd| ifd.value(craft_tiff::tags::EXTRA_SAMPLES)).map(|v| v.to_u64_vec().into_iter().map(|x| x as u16).collect()).unwrap_or_default()
|
||||
tiff.ifds
|
||||
.first()
|
||||
.and_then(|ifd| ifd.value(craft_tiff::tags::EXTRA_SAMPLES))
|
||||
.map(|v| v.to_u64_vec().into_iter().map(|x| x as u16).collect())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// A TIFF's channel resources: the names in 1006, and the byte lengths of DisplayInfo (1077)
|
||||
|
||||
Reference in new issue
Block a user