WIP: Introduce layers in renderer

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-03-22 18:55:53 +01:00
co-authored by Nathan Sobo
parent bfc57cb4f6
commit 859c0f53cb
3 changed files with 12 additions and 12 deletions
+2
View File
@@ -49,7 +49,9 @@ impl Element for Stack {
ctx: &mut PaintContext,
) -> Self::PaintState {
for child in &mut self.children {
ctx.scene.push_layer();
child.paint(bounds.origin(), ctx);
ctx.scene.pop_layer();
}
}
+9 -7
View File
@@ -56,14 +56,16 @@ impl Scene {
self.layers.as_slice()
}
// pub fn push_layer(&mut self, clip_bounds: Option<RectF>) {
pub fn push_layer(&mut self) {
let ix = self.layers.len();
self.layers.push(Layer::default());
self.active_layer_stack.push(ix);
}
// }
// pub fn pop_layer(&mut self) {
// assert!(self.active_layer_stack.len() > 1);
// self.active_layer_stack.pop();
// }
pub fn pop_layer(&mut self) {
assert!(self.active_layer_stack.len() > 1);
self.active_layer_stack.pop();
}
pub fn push_quad(&mut self, quad: Quad) {
self.active_layer().push_quad(quad)