diff --git a/crates/compose/src/composite.rs b/crates/compose/src/composite.rs index 73e54d89110..e53b492fc56 100644 --- a/crates/compose/src/composite.rs +++ b/crates/compose/src/composite.rs @@ -1,4 +1,4 @@ -use super::content::{channel_weights, empty_in, render_content_with, restore_channels, surface_to_buffer, surface_to_buffer_with}; +use super::content::{channel_weights, empty_in, render_content_with, restore_channels, surface_to_buffer_with}; use super::ctx::Ctx; use super::extents::{effects_frame, mask_k, mask_vals, recycle_mask, shapeless_stroke_bounds}; use super::fx_cache::effect_maps_with; @@ -598,14 +598,7 @@ pub fn text_gamma(layer: &Layer) -> f32 { /// A stroked shape layer with visible clipped layers: Photoshop draws the shape's vector stroke /// above the clipped layers, so the base content is the fill alone and the stroke is laid on top -/// after clipping. See [`split_parts`]. -fn shape_parts(layer: &Layer, clipped: &[Layer], rect: Rect, cx: &Ctx) -> Option<(Buffer, Buffer, Option>)> { - if !clipped.iter().any(|c| c.visible) { - return None; - } - split_parts(layer, rect, cx) -} - +/// after clipping. See [`split_parts_with`]. fn shape_parts_with( layer: &Layer, clipped: &[Layer], @@ -623,13 +616,6 @@ fn shape_parts_with( /// layers. Fill and stroke are unmasked: the mask applies to them together. Layer effects paint /// the fill's interior effects beneath the vector stroke (psd-tools stroke-composite: a colour /// overlay leaves the stroke, the stroke effect covers it). -fn split_parts(layer: &Layer, rect: Rect, cx: &Ctx) -> Option<(Buffer, Buffer, Option>)> { - let LayerContent::Shape(sh) = &layer.content else { return None }; - sh.stroke.as_ref()?; - let (fs, ss) = shape_split::split(sh, cx.canvas, cx.depth)?; - Some((surface_to_buffer(&fs, rect), surface_to_buffer(&ss, rect), mask_vals(layer, rect, cx))) -} - fn split_parts_with( layer: &Layer, rect: Rect, diff --git a/crates/compose/src/content.rs b/crates/compose/src/content.rs index a77551b1822..d42055471a2 100644 --- a/crates/compose/src/content.rs +++ b/crates/compose/src/content.rs @@ -28,6 +28,7 @@ fn scratch_reuse_preserves_pixels() { /// Render a layer's own content (no blending into the backdrop yet) into an isolated buffer. /// Returns None for layers that operate on the backdrop (adjustments, pass-through groups). +#[cfg(test)] pub(crate) fn render_content(layer: &Layer, rect: Rect, cx: &Ctx) -> Option { match render_content_with(layer, rect, cx, &InfallibleBufferAlloc) { Ok(buffer) => buffer, diff --git a/crates/compose/src/lib.rs b/crates/compose/src/lib.rs index bc9f3d4c0c0..898c8faa057 100644 --- a/crates/compose/src/lib.rs +++ b/crates/compose/src/lib.rs @@ -60,7 +60,9 @@ use composite::{composite_stack_at, dissolve_noise}; #[cfg(test)] use content::render_fill; pub use content::{RENDER_TILE, channel_weights, fill_frame, layer_shape, render_fill_content, stroke_frame, surface_to_buffer}; -use content::{empty_in, render_content}; +use content::empty_in; +#[cfg(test)] +use content::render_content; use ctx::{Ctx, prepare_effects}; #[cfg(test)] use ctx::{LayerKeys, PREPARE_DEPTH, effect_layers, prepare_tones};