Keep transient surface generations out of content diagnostics

This commit is contained in:
FredApps committed 2026-11-19 12:53:45 +01:00
1 parent eb67d8f066
commit 0d2ed110e8
1 file changed
+9 -1
+9 -1
View File
@@ -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<TileCoord, Arc<Tile>>,
}
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<f32>) -> &'a mut [f32] {
if let Some(samples) = stack.get_mut(..channels) {