Resize base layer in Stack before drawing

This commit is contained in:
Héctor Ramón Jiménez 2025-08-17 00:58:37 +02:00
parent 46167c78c7
commit d2f36a0a58
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 14 additions and 13 deletions

View file

@ -158,12 +158,15 @@ impl<T: Layer> Stack<T> {
/// Clears the layers of the [`Stack`], allowing reuse.
///
/// It resizes the base layer bounds to the `new_bounds`.
///
/// This will normally keep layer allocations for future drawing operations.
pub fn clear(&mut self) {
pub fn reset(&mut self, new_bounds: Rectangle) {
for layer in self.layers[..self.active_count].iter_mut() {
layer.reset();
}
self.layers[0].resize(new_bounds);
self.current = 0;
self.active_count = 1;
self.previous.clear();