Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logic for tiling from Servo into rust-layers #75

Merged
merged 1 commit into from Jul 2, 2014

Conversation

@mrobinson
Copy link
Member

mrobinson commented Jul 1, 2014

Pull in the quadtree implementation from Servo and rework the way that
tiles are stored in the layer tree. Instead of storing tiles in-tree,
simply hang them off of ContainerLayer separately. Also have
ContainerLayer templatized to hold arbitrary data, which will prevent
Servo from having to mirror the tree using Servo CompositorLayers.

@mrobinson mrobinson changed the title u Move logic for tiling from Servo into rust-layers Jul 1, 2014
layers.rs Outdated
pub extra_data: RefCell<T>,
}

pub fn ContainerLayer<T>(page_size: Option<Size2D<f32>>, tile_size: uint, data: T) -> ContainerLayer<T> {

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

nit: at some point this should be modernized to:

impl ContainerLayer<T> {
    fn new(...) -> ContainerLayer<T> {
        ...
    }
}
layers.rs Outdated
ContainerLayer {
common: RefCell::new(CommonLayer()),
first_child: RefCell::new(None),
last_child: RefCell::new(None),
scissor: RefCell::new(None),
quadtree: match page_size {
None =>

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

nit: use {} to match the other branch below.

layers.rs Outdated
ChildIterator {
current: self.first_child.borrow().clone(),
}
}

pub fn with_common<R>(&self, f: |&mut CommonLayer<T>| -> R) -> R {

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

This with_common pattern is not really recommended anymore. Instead I'd change it to:

pub fn common<'a>(&'a self) -> RefMut<'a,CommonLayer<T>> {
    self.common.borrow_mut()
}

That eliminates rightward drift from callers.

layers.rs Outdated
pseudo_self.tile_size
}

pub fn get_tile_rects_page(pseudo_self: Rc<ContainerLayer<T>>, window: Rect<f32>, scale: f32) -> (Vec<BufferRequest>, Vec<Box<LayerBuffer>>) {

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

Bummer that you need pseudo_self. The naming convention I usually use is this.

In a future version of Rust this will not be necessary. :)

layers.rs Outdated
pub page_rect: Rect<f32>,
}

pub fn BufferRequest(screen_rect: Rect<uint>, page_rect: Rect<f32>) -> BufferRequest {

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

nit: as above, change this to fn new.

rendergl.rs Outdated
@@ -369,9 +370,12 @@ impl Render for layers::ContainerLayer {
// NOTE: work around borrowchk

This comment has been minimized.

@pcwalton

pcwalton Jul 1, 2014

Contributor

I bet the {} below and this comment are obsolete; can you remove them?

@pcwalton
Copy link
Contributor

pcwalton commented Jul 1, 2014

Assuming that you didn't modify quadtree.rs and that the inclusion of tiled_layer.rs was an accident, r=me with nits addressed and tiled_layer.rs removed.

Pull in the quadtree implementation from Servo and rework the way that
tiles are stored in the layer tree. Instead of storing tiles in-tree,
simply hang them off of ContainerLayer separately. Also have
ContainerLayer templatized to hold arbitrary data, which will prevent
Servo from having to mirror the tree using Servo CompositorLayers.
pcwalton added a commit that referenced this pull request Jul 2, 2014
 Move logic for tiling from Servo into rust-layers
@pcwalton pcwalton merged commit 5ff99f3 into servo:master Jul 2, 2014
@mrobinson mrobinson deleted the mrobinson:layer-reorg branch Jul 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.