diff --git a/crates/engine/tests/it/atn_v12.rs b/crates/engine/tests/it/atn_v12.rs index bcb4e8d8400..676e5856ad1 100644 --- a/crates/engine/tests/it/atn_v12.rs +++ b/crates/engine/tests/it/atn_v12.rs @@ -5,7 +5,7 @@ use serde_json::json; /// Legacy descriptor syntax must reach the same commands and parameters as version 16. #[test] fn legacy_v12_commands_import_like_v16() { - let bytes = include_bytes!("../../fixtures/atn/v12-commands.atn"); + let bytes = include_bytes!("../fixtures/atn/v12-commands.atn"); let modern = atn::write(&atn::parse(bytes).unwrap()).unwrap(); let expected = vec![ ("filter.blur.gaussianBlur".into(), json!({"radius": 2.5})), diff --git a/crates/io/src/svg.rs b/crates/io/src/svg.rs index 0bd27cfd6dc..db24a0ada71 100644 --- a/crates/io/src/svg.rs +++ b/crates/io/src/svg.rs @@ -824,7 +824,10 @@ fn inflate(bytes: &[u8]) -> Result, IoError> { /// [`inflate`] with an explicit `limit`, which also applies to uncompressed input. fn inflate_with_limit(bytes: &[u8], limit: u64) -> Result, IoError> { let limit = usize::try_from(limit).unwrap_or(usize::MAX); - craft_svg::svgz::inflate(bytes, limit).map_err(|e| IoError::Svg(e.to_string())) + craft_svg::svgz::inflate(bytes, limit).map_err(|e| match e { + craft_svg::svgz::Error::TooLarge(_) if bytes.starts_with(&[0x1f, 0x8b]) => IoError::Svg(format!("compressed SVG inflates past {limit} bytes")), + error => IoError::Svg(error.to_string()), + }) } /// The deepest element nesting in `xml`, stopping as soon as it passes `limit` (the result is diff --git a/crates/io/tests/it/raw.rs b/crates/io/tests/it/raw.rs index 748aaa7c67b..1f5ffd9c738 100644 --- a/crates/io/tests/it/raw.rs +++ b/crates/io/tests/it/raw.rs @@ -239,7 +239,7 @@ fn unsupported_raw_falls_back_to_the_embedded_preview() { } /// A DNG 1.7 laid out as converters write one with JPEG XL raw data: an 8×6 JPEG thumbnail in -/// IFD0, raw data this reader refuses (here floating-point LinearRaw), and a 40×30 preview +/// IFD0, raw data this reader refuses (here 64-bit floating-point LinearRaw), and a 40×30 preview /// compressed with JPEG XL, stored as the raw is (IFD0 Orientation 6). fn dng_with_jxl_preview() -> Vec { use zune_core::{bit_depth::BitDepth, colorspace::ColorSpace, options::EncoderOptions}; @@ -250,18 +250,18 @@ fn dng_with_jxl_preview() -> Vec { let mut preview = Vec::new(); zune_jpegxl::JxlSimpleEncoder::new(&rgb, EncoderOptions::new(w, h, ColorSpace::RGB, BitDepth::Eight)).encode(&mut preview).unwrap(); let mut t = TiffBuilder::default(); - let raw_strip = t.blob(vec![0; 4 * 4 * 3 * 2]); + let raw_strip = t.blob(vec![0; 4 * 4 * 3 * 8]); let raw = t.ifd(vec![ (254, Val::Long(vec![0])), (256, Val::Long(vec![4])), (257, Val::Long(vec![4])), - (258, Val::Short(vec![16, 16, 16])), + (258, Val::Short(vec![64, 64, 64])), (259, Val::Short(vec![1])), (262, Val::Short(vec![34892])), (273, Val::Blobs(vec![raw_strip])), (277, Val::Short(vec![3])), (278, Val::Long(vec![4])), - (279, Val::Long(vec![4 * 4 * 3 * 2])), + (279, Val::Long(vec![4 * 4 * 3 * 8])), (339, Val::Short(vec![3, 3, 3])), ]); let preview_len = preview.len() as u32; diff --git a/crates/ui-egui/src/canvas/strokes.rs b/crates/ui-egui/src/canvas/strokes.rs index 8ca07491e18..33e54313b05 100644 --- a/crates/ui-egui/src/canvas/strokes.rs +++ b/crates/ui-egui/src/canvas/strokes.rs @@ -565,16 +565,24 @@ pub(super) fn offer_live_retouch(app: &mut PhotocraftApp, d: &Drag) { let rest: Vec<_> = d.points.get(fed..).unwrap_or_default().iter().map(|q| photocraft_engine::paint::StrokePoint::new(q[0], q[1], q[2] as f32)).collect(); // A refused offer (the brush changed mid-stroke, say) leaves the commit to render the stroke. match stroke { - EngineStroke::Retouch(mut live) if !dab && (rest.is_empty() || live.push(&rest).is_ok()) => { - let _ = app.session.offer_live_retouch(*live); - } - EngineStroke::Dab(mut live) if dab && (rest.is_empty() || live.push(&rest).is_ok()) => { - let _ = app.session.offer_live_dab(*live); - } + EngineStroke::Retouch(live) if !dab => offer_retouch(app, live, &rest), + EngineStroke::Dab(live) if dab => offer_dab(app, live, &rest), _ => {} } } +fn offer_retouch(app: &mut PhotocraftApp, mut live: Box, rest: &[photocraft_engine::paint::StrokePoint]) { + if rest.is_empty() || live.push(rest).is_ok() { + let _ = app.session.offer_live_retouch(*live); + } +} + +fn offer_dab(app: &mut PhotocraftApp, mut live: Box, rest: &[photocraft_engine::paint::StrokePoint]) { + if rest.is_empty() || live.push(rest).is_ok() { + let _ = app.session.offer_live_dab(*live); + } +} + /// A pen tap (a drag still at its one press point when released) paints its dab at the highest /// pressure the pen reached during the contact, not just the first sample's (#1798). A mouse is /// unchanged at full pressure.