Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMove logic for tiling from Servo into rust-layers #75
Conversation
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
rendergl.rs
Outdated
| @@ -369,9 +370,12 @@ impl Render for layers::ContainerLayer { | |||
| // NOTE: work around borrowchk | |||
This comment has been minimized.
This comment has been minimized.
pcwalton
Jul 1, 2014
Contributor
I bet the {} below and this comment are obsolete; can you remove them?
|
Assuming that you didn't modify |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
mrobinson commentedJul 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.