🐛 Clear doc atlas when canvas background color changes (#12112)

This commit is contained in:
Elena Torró 2026-10-06 10:34:47 +02:00 committed by GitHub
parent b41445d092
commit 70dfe90571
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -986,7 +986,12 @@ impl RenderState {
}
pub fn set_background_color(&mut self, color: skia::Color) {
if self.background_color == color {
return;
}
self.background_color = color;
// Tiles bake the background in; old atlas pixels would show on pan/zoom.
self.surfaces.atlas.clear();
}
pub fn set_preview_mode(&mut self, enabled: bool) {

View File

@ -185,6 +185,12 @@ impl DocAtlas {
self.size.width <= 0 || self.size.height <= 0
}
/// Drops all atlas content while keeping its allocation and placement.
pub fn clear(&mut self) {
self.surface.canvas().clear(skia::Color::TRANSPARENT);
self.tile_doc_rects.clear();
}
/// Sets the document-space bounds used to clamp atlas updates.
/// Pass `None` to disable clamping.
pub fn set_doc_bounds(&mut self, bounds: Option<skia::Rect>) {