mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Eliminate ad-hoc recursion in set_unrendered_color
This commit is contained in:
parent
0396cdb1c5
commit
f91d51cb2c
2 changed files with 11 additions and 25 deletions
|
@ -348,12 +348,16 @@ impl IOCompositor {
|
||||||
|
|
||||||
fn set_unrendered_color(&mut self, pipeline_id: PipelineId, layer_id: LayerId, color: Color) {
|
fn set_unrendered_color(&mut self, pipeline_id: PipelineId, layer_id: LayerId, color: Color) {
|
||||||
match self.scene.root {
|
match self.scene.root {
|
||||||
Some(ref layer) => CompositorData::set_unrendered_color(layer.clone(),
|
Some(ref root_layer) => {
|
||||||
pipeline_id,
|
match CompositorData::find_layer_with_pipeline_and_layer_id(root_layer.clone(),
|
||||||
layer_id,
|
pipeline_id,
|
||||||
color),
|
layer_id) {
|
||||||
None => false,
|
Some(ref layer) => CompositorData::set_unrendered_color(layer.clone(), color),
|
||||||
};
|
None => { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_ids(&mut self,
|
fn set_ids(&mut self,
|
||||||
|
|
|
@ -813,26 +813,8 @@ impl CompositorData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_unrendered_color(layer: Rc<Layer<CompositorData>>,
|
pub fn set_unrendered_color(layer: Rc<Layer<CompositorData>>, color: Color) {
|
||||||
pipeline_id: PipelineId,
|
|
||||||
layer_id: LayerId,
|
|
||||||
color: Color)
|
|
||||||
-> bool {
|
|
||||||
if layer.extra_data.borrow().pipeline.id != pipeline_id ||
|
|
||||||
layer.extra_data.borrow().id != layer_id {
|
|
||||||
for child_layer in layer.children().iter() {
|
|
||||||
if CompositorData::set_unrendered_color(child_layer.clone(),
|
|
||||||
pipeline_id,
|
|
||||||
layer_id,
|
|
||||||
color) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
layer.extra_data.borrow_mut().unrendered_color = color;
|
layer.extra_data.borrow_mut().unrendered_color = color;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue