Skip to content

Commit

Permalink
Correct draw order for frame tree layers
Browse files Browse the repository at this point in the history
  • Loading branch information
eschweic committed Aug 22, 2013
1 parent 48f9e9a commit a07ff5d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
41 changes: 21 additions & 20 deletions src/components/main/compositing/compositor_layer.rs
Expand Up @@ -109,7 +109,7 @@ impl CompositorLayer {
}

let child_layer = ~CompositorLayer::from_frame_tree(frame_tree, tile_size, max_mem);
container.add_child(ContainerLayerKind(child_layer.root_layer));
container.add_child_start(ContainerLayerKind(child_layer.root_layer));

CompositorLayerChild {
child: child_layer,
Expand Down Expand Up @@ -342,25 +342,9 @@ impl CompositorLayer {
self.root_layer.remove_child(trash);
}

// Add child layers.
for child in self.children.mut_iter().filter(|x| !x.child.hidden) {
current_layer_child = match current_layer_child {
None => {
child.container.common.parent = None;
child.container.common.prev_sibling = None;
child.container.common.next_sibling = None;
self.root_layer.add_child(ContainerLayerKind(child.container));
None
}
Some(_) => {
fail!("CompositorLayer: Layer tree failed to delete");
}
};
}

// Add new tiles.
let quadtree = match self.quadtree {
NoTree(_, _) => fail!("CompositorLayer: cannot get buffer request for %?,
NoTree(_, _) => fail!("CompositorLayer: cannot get build layer tree for %?,
no quadtree initialized", self.pipeline.id),
Tree(ref mut quadtree) => quadtree,
};
Expand All @@ -376,7 +360,7 @@ impl CompositorLayer {
debug!("osmain: adding new texture layer");
texture_layer = @mut TextureLayer::new(@buffer.draw_target.clone() as @TextureManager,
buffer.screen_pos.size);
self.root_layer.add_child(TextureLayerKind(texture_layer));
self.root_layer.add_child_end(TextureLayerKind(texture_layer));
None
}
Some(TextureLayerKind(existing_texture_layer)) => {
Expand All @@ -399,6 +383,23 @@ impl CompositorLayer {
texture_layer.common.set_transform(transform);
}

// Add child layers.
for child in self.children.mut_iter().filter(|x| !x.child.hidden) {
current_layer_child = match current_layer_child {
None => {
child.container.common.parent = None;
child.container.common.prev_sibling = None;
child.container.common.next_sibling = None;
self.root_layer.add_child_end(ContainerLayerKind(child.container));
None
}
Some(_) => {
fail!("CompositorLayer: Layer tree failed to delete");
}
};
}


}

// Add LayerBuffers to the specified layer. Returns false if the layer is not found.
Expand Down Expand Up @@ -472,7 +473,7 @@ impl CompositorLayer {
clipping_rect.origin.y,
0.0));
let child = ~CompositorLayer::new(pipeline, page_size, tile_size, max_mem);
container.add_child(ContainerLayerKind(child.root_layer));
container.add_child_start(ContainerLayerKind(child.root_layer));
self.children.push(CompositorLayerChild {
child: child,
container: container,
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/compositing/mod.rs
Expand Up @@ -263,7 +263,7 @@ impl CompositorTask {
let layer = CompositorLayer::from_frame_tree(frame_tree,
self.opts.tile_size,
Some(10000000u));
root_layer.add_child(ContainerLayerKind(layer.root_layer));
root_layer.add_child_start(ContainerLayerKind(layer.root_layer));
compositor_layer = Some(layer);

constellation_chan = Some(new_constellation_chan);
Expand Down Expand Up @@ -294,7 +294,7 @@ impl CompositorTask {
Some(old_layer) => root_layer.remove_child(old_layer),
None => {}
}
root_layer.add_child(ContainerLayerKind(new_layer.root_layer));
root_layer.add_child_start(ContainerLayerKind(new_layer.root_layer));
compositor_layer = Some(new_layer);

ask_for_tiles();
Expand Down
13 changes: 6 additions & 7 deletions src/components/main/compositing/quadtree.rs
Expand Up @@ -340,23 +340,22 @@ impl<T: Tile> QuadtreeNode<T> {
}
}

/// Get all tiles in the tree, parents last.
/// Get all tiles in the tree, parents first.
fn get_all_tiles<'r>(&'r self) -> ~[&'r T] {
let mut ret = ~[];

match self.tile {
Some(ref tile) => ret = ret + ~[tile],
None => {}
}

for quad in self.quadrants.iter() {
match *quad {
Some(ref child) => ret = ret + child.get_all_tiles(),
None => {}
}
}

match self.tile {
Some(ref tile) => ret = ret + ~[tile],
None => {}
}


return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion src/support/layers/rust-layers

0 comments on commit a07ff5d

Please sign in to comment.