no branching allowed
This commit is contained in:
@@ -11,15 +11,15 @@ pub struct Stack {
|
|||||||
impl Widget for Stack {
|
impl Widget for Stack {
|
||||||
fn draw(&mut self, painter: &mut Painter) {
|
fn draw(&mut self, painter: &mut Painter) {
|
||||||
for _ in 0..self.offset {
|
for _ in 0..self.offset {
|
||||||
painter.layer = painter.next_layer();
|
painter.next_layer();
|
||||||
}
|
}
|
||||||
let base = painter.layer;
|
let mut iter = self.children.iter();
|
||||||
for child in &self.children {
|
if let Some(child) = iter.next() {
|
||||||
painter.layer = if painter.layer == base {
|
painter.child_layer();
|
||||||
painter.child_layer()
|
painter.widget(child);
|
||||||
} else {
|
}
|
||||||
painter.next_layer()
|
for child in iter {
|
||||||
};
|
painter.next_layer();
|
||||||
painter.widget(child);
|
painter.widget(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,12 +291,12 @@ impl<'a, 'c> Painter<'a, 'c> {
|
|||||||
self.ctx.text
|
self.ctx.text
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn child_layer(&mut self) -> usize {
|
pub fn child_layer(&mut self) {
|
||||||
self.ctx.layers.child(self.layer)
|
self.layer = self.ctx.layers.child(self.layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_layer(&mut self) -> usize {
|
pub fn next_layer(&mut self) {
|
||||||
self.ctx.layers.next(self.layer)
|
self.layer = self.ctx.layers.next(self.layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user