mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Cleanup after merge
This commit is contained in:
parent
1948280aec
commit
1b225fbad2
2 changed files with 14 additions and 12 deletions
|
@ -74,7 +74,6 @@ impl RenderListener for CompositorChan {
|
||||||
self.chan.send(Paint(id, layer_buffer_set, new_size))
|
self.chan.send(Paint(id, layer_buffer_set, new_size))
|
||||||
}
|
}
|
||||||
|
|
||||||
//eschweic
|
|
||||||
fn new_layer(&self, page_size: Size2D<uint>, tile_size: uint) {
|
fn new_layer(&self, page_size: Size2D<uint>, tile_size: uint) {
|
||||||
self.chan.send(NewLayer(page_size, tile_size))
|
self.chan.send(NewLayer(page_size, tile_size))
|
||||||
}
|
}
|
||||||
|
@ -229,7 +228,7 @@ impl CompositorTask {
|
||||||
|
|
||||||
// Quadtree for this layer
|
// Quadtree for this layer
|
||||||
// FIXME: This should be one-per-layer
|
// FIXME: This should be one-per-layer
|
||||||
let quadtree: @mut Option<Quadtree<LayerBuffer>> = @mut None;
|
let quadtree: @mut Option<Quadtree<~LayerBuffer>> = @mut None;
|
||||||
|
|
||||||
|
|
||||||
let ask_for_tiles: @fn() = || {
|
let ask_for_tiles: @fn() = || {
|
||||||
|
@ -241,9 +240,11 @@ impl CompositorTask {
|
||||||
let mut tile_request = ~[]; //FIXME: try not to allocate if possible
|
let mut tile_request = ~[]; //FIXME: try not to allocate if possible
|
||||||
|
|
||||||
let mut y = world_offset.y as uint;
|
let mut y = world_offset.y as uint;
|
||||||
while y < world_offset.y as uint + window_size.height + tile_size {
|
while y < world_offset.y as uint + window_size.height &&
|
||||||
|
y <= (page_size.height * *world_zoom) as uint {
|
||||||
let mut x = world_offset.x as uint;
|
let mut x = world_offset.x as uint;
|
||||||
while x < world_offset.x as uint + window_size.width + tile_size {
|
while x < world_offset.x as uint + window_size.width &&
|
||||||
|
x <= (page_size.width * *world_zoom) as uint {
|
||||||
match *(quad.get_tile(x, y, *world_zoom)) {
|
match *(quad.get_tile(x, y, *world_zoom)) {
|
||||||
Some(ref current_tile) => {
|
Some(ref current_tile) => {
|
||||||
if current_tile.resolution == *world_zoom {
|
if current_tile.resolution == *world_zoom {
|
||||||
|
@ -293,7 +294,7 @@ impl CompositorTask {
|
||||||
let layout_chan_clone = layout_chan.clone();
|
let layout_chan_clone = layout_chan.clone();
|
||||||
// Hook the windowing system's resize callback up to the resize rate limiter.
|
// Hook the windowing system's resize callback up to the resize rate limiter.
|
||||||
do window.set_resize_callback |width, height| {
|
do window.set_resize_callback |width, height| {
|
||||||
let new_size = Size2D(width as int, height as int);
|
let new_size = Size2D(width as uint, height as uint);
|
||||||
if *window_size != new_size {
|
if *window_size != new_size {
|
||||||
debug!("osmain: window resized to %ux%u", width, height);
|
debug!("osmain: window resized to %ux%u", width, height);
|
||||||
*window_size = new_size;
|
*window_size = new_size;
|
||||||
|
@ -403,11 +404,11 @@ impl CompositorTask {
|
||||||
let mut current_layer_child = root_layer.first_child;
|
let mut current_layer_child = root_layer.first_child;
|
||||||
|
|
||||||
// Replace the image layer data with the buffer data.
|
// Replace the image layer data with the buffer data.
|
||||||
let buffers = util::replace(&mut new_layer_buffer_set.buffers, ~[]);
|
// let buffers = util::replace(&mut new_layer_buffer_set.buffers, ~[]);
|
||||||
|
|
||||||
do vec::consume(buffers) |_, buffer| {
|
for new_layer_buffer_set.buffers.iter().advance |buffer| {
|
||||||
quad.add_tile(buffer.screen_pos.origin.x, buffer.screen_pos.origin.y,
|
quad.add_tile(buffer.screen_pos.origin.x, buffer.screen_pos.origin.y,
|
||||||
*world_zoom, buffer);
|
*world_zoom, ~buffer.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
for quad.get_all_tiles().each |buffer| {
|
for quad.get_all_tiles().each |buffer| {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
|
use std::uint::{div_ceil, next_power_of_two};
|
||||||
|
|
||||||
/// Parent to all quadtree nodes. Stores variables needed at all levels. All method calls
|
/// Parent to all quadtree nodes. Stores variables needed at all levels. All method calls
|
||||||
/// at this level are in pixel coordinates.
|
/// at this level are in pixel coordinates.
|
||||||
|
@ -40,8 +41,8 @@ impl<T> Quadtree<T> {
|
||||||
pub fn new(x: uint, y: uint, width: uint, height: uint, tile_size: uint) -> Quadtree<T> {
|
pub fn new(x: uint, y: uint, width: uint, height: uint, tile_size: uint) -> Quadtree<T> {
|
||||||
// Spaces must be squares and powers of 2, so expand the space until it is
|
// Spaces must be squares and powers of 2, so expand the space until it is
|
||||||
let longer = width.max(&height);
|
let longer = width.max(&height);
|
||||||
let num_tiles = uint::div_ceil(longer, tile_size);
|
let num_tiles = div_ceil(longer, tile_size);
|
||||||
let power_of_two = uint::next_power_of_two(num_tiles);
|
let power_of_two = next_power_of_two(num_tiles);
|
||||||
let size = power_of_two * tile_size;
|
let size = power_of_two * tile_size;
|
||||||
|
|
||||||
Quadtree {
|
Quadtree {
|
||||||
|
@ -211,9 +212,9 @@ impl<T> QuadtreeNode<T> {
|
||||||
let index = self.get_quadrant(x,y) as int;
|
let index = self.get_quadrant(x,y) as int;
|
||||||
match self.quadrants[index] {
|
match self.quadrants[index] {
|
||||||
None => {
|
None => {
|
||||||
// calculate where the new tile should go
|
// Calculate where the new tile should go
|
||||||
let factor = self.size / tile_size;
|
let factor = self.size / tile_size;
|
||||||
let divisor = uint::next_power_of_two(factor.ceil() as uint);
|
let divisor = next_power_of_two(factor.ceil() as uint);
|
||||||
let new_size_page = self.size / (divisor as f32);
|
let new_size_page = self.size / (divisor as f32);
|
||||||
let new_size_pixel = (new_size_page * scale).ceil() as uint;
|
let new_size_pixel = (new_size_page * scale).ceil() as uint;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue