From 0d2ed110e8b4580dc5c4f25c8e88d42010682065 Mon Sep 17 00:00:00 2001 From: FredApps Date: Thu, 19 Nov 2026 12:53:45 +0100 Subject: [PATCH] Keep transient surface generations out of content diagnostics --- crates/raster/src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/raster/src/lib.rs b/crates/raster/src/lib.rs index 8255122bb8..8bb7d13a77 100644 --- a/crates/raster/src/lib.rs +++ b/crates/raster/src/lib.rs @@ -309,7 +309,7 @@ impl PruneCursor { } } -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct Surface { generation: u64, format: PixelFormat, @@ -317,6 +317,14 @@ pub struct Surface { tiles: BTreeMap>, } +impl std::fmt::Debug for Surface { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + // The generation identifies an edit history. Independently opened copies of the same + // document should retain the same content representation. + f.debug_struct("Surface").field("format", &self.format).field("default_pixel", &self.default_pixel).field("tiles", &self.tiles).finish() + } +} + /// Use stack storage when it fits, otherwise reuse a dynamically sized sample buffer. fn sample_buffer<'a>(channels: usize, stack: &'a mut [f32], heap: &'a mut Vec) -> &'a mut [f32] { if let Some(samples) = stack.get_mut(..channels) {