mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Always create CompositorData with a new layer
Since it makes no sense to create one without the other, the public interface shouldn't let you do anything else.
This commit is contained in:
parent
31049adc1d
commit
2e40baba09
2 changed files with 17 additions and 20 deletions
|
@ -31,7 +31,6 @@ use layers::layers::LayerBufferSet;
|
||||||
use layers::rendergl;
|
use layers::rendergl;
|
||||||
use layers::rendergl::RenderContext;
|
use layers::rendergl::RenderContext;
|
||||||
use layers::scene::Scene;
|
use layers::scene::Scene;
|
||||||
use layers::layers::Layer;
|
|
||||||
use opengles::gl2;
|
use opengles::gl2;
|
||||||
use png;
|
use png;
|
||||||
use servo_msg::compositor_msg::{Blank, Epoch, FixedPosition, FinishedLoading, IdleRenderState};
|
use servo_msg::compositor_msg::{Blank, Epoch, FixedPosition, FinishedLoading, IdleRenderState};
|
||||||
|
@ -369,16 +368,14 @@ impl IOCompositor {
|
||||||
pipeline_id: root_pipeline.id,
|
pipeline_id: root_pipeline.id,
|
||||||
epoch: layer_properties.epoch,
|
epoch: layer_properties.epoch,
|
||||||
id: LayerId::null(),
|
id: LayerId::null(),
|
||||||
rect: Rect::zero(),
|
rect: layer_properties.rect,
|
||||||
background_color: layer_properties.background_color,
|
background_color: layer_properties.background_color,
|
||||||
scroll_policy: FixedPosition,
|
scroll_policy: FixedPosition,
|
||||||
};
|
};
|
||||||
let new_compositor_data = CompositorData::new(root_pipeline,
|
let new_root = CompositorData::new_layer(root_pipeline,
|
||||||
root_properties,
|
root_properties,
|
||||||
WantsScrollEvents);
|
WantsScrollEvents,
|
||||||
let new_root = Rc::new(Layer::new(layer_properties.rect,
|
self.opts.tile_size);
|
||||||
self.opts.tile_size,
|
|
||||||
new_compositor_data));
|
|
||||||
|
|
||||||
CompositorData::add_child(new_root.clone(), layer_properties);
|
CompositorData::add_child(new_root.clone(), layer_properties);
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,12 @@ pub enum WantsScrollEventsFlag {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CompositorData {
|
impl CompositorData {
|
||||||
pub fn new(pipeline: CompositionPipeline,
|
pub fn new_layer(pipeline: CompositionPipeline,
|
||||||
layer_properties: LayerProperties,
|
layer_properties: LayerProperties,
|
||||||
wants_scroll_events: WantsScrollEventsFlag)
|
wants_scroll_events: WantsScrollEventsFlag,
|
||||||
-> CompositorData {
|
tile_size: uint)
|
||||||
CompositorData {
|
-> Rc<Layer<CompositorData>> {
|
||||||
|
let new_compositor_data = CompositorData {
|
||||||
pipeline: pipeline,
|
pipeline: pipeline,
|
||||||
id: layer_properties.id,
|
id: layer_properties.id,
|
||||||
scroll_offset: TypedPoint2D(0f32, 0f32),
|
scroll_offset: TypedPoint2D(0f32, 0f32),
|
||||||
|
@ -64,7 +65,8 @@ impl CompositorData {
|
||||||
scroll_policy: layer_properties.scroll_policy,
|
scroll_policy: layer_properties.scroll_policy,
|
||||||
background_color: layer_properties.background_color,
|
background_color: layer_properties.background_color,
|
||||||
epoch: layer_properties.epoch,
|
epoch: layer_properties.epoch,
|
||||||
}
|
};
|
||||||
|
Rc::new(Layer::new(layer_properties.rect, tile_size, new_compositor_data))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a child layer to the layer with the given ID and the given pipeline, if it doesn't
|
/// Adds a child layer to the layer with the given ID and the given pipeline, if it doesn't
|
||||||
|
@ -72,12 +74,10 @@ impl CompositorData {
|
||||||
/// painting status as its parent.
|
/// painting status as its parent.
|
||||||
pub fn add_child(layer: Rc<Layer<CompositorData>>,
|
pub fn add_child(layer: Rc<Layer<CompositorData>>,
|
||||||
layer_properties: LayerProperties) {
|
layer_properties: LayerProperties) {
|
||||||
let new_compositor_data = CompositorData::new(layer.extra_data.borrow().pipeline.clone(),
|
let new_kid = CompositorData::new_layer(layer.extra_data.borrow().pipeline.clone(),
|
||||||
layer_properties,
|
layer_properties,
|
||||||
DoesntWantScrollEvents);
|
DoesntWantScrollEvents,
|
||||||
let new_kid = Rc::new(Layer::new(layer_properties.rect,
|
layer.tile_size);
|
||||||
layer.tile_size,
|
|
||||||
new_compositor_data));
|
|
||||||
layer.add_child(new_kid.clone());
|
layer.add_child(new_kid.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue