Cleanup after merge

This commit is contained in:
eschweic 2013-07-03 09:33:02 -07:00
parent 1948280aec
commit 1b225fbad2
2 changed files with 14 additions and 12 deletions

View file

@ -74,7 +74,6 @@ impl RenderListener for CompositorChan {
self.chan.send(Paint(id, layer_buffer_set, new_size))
}
//eschweic
fn new_layer(&self, page_size: Size2D<uint>, tile_size: uint) {
self.chan.send(NewLayer(page_size, tile_size))
}
@ -229,7 +228,7 @@ impl CompositorTask {
// Quadtree for this 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() = || {
@ -241,9 +240,11 @@ impl CompositorTask {
let mut tile_request = ~[]; //FIXME: try not to allocate if possible
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;
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)) {
Some(ref current_tile) => {
if current_tile.resolution == *world_zoom {
@ -293,7 +294,7 @@ impl CompositorTask {
let layout_chan_clone = layout_chan.clone();
// Hook the windowing system's resize callback up to the resize rate limiter.
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 {
debug!("osmain: window resized to %ux%u", width, height);
*window_size = new_size;
@ -403,11 +404,11 @@ impl CompositorTask {
let mut current_layer_child = root_layer.first_child;
// 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,
*world_zoom, buffer);
*world_zoom, ~buffer.clone());
}
for quad.get_all_tiles().each |buffer| {

View file

@ -8,6 +8,7 @@
use geom::point::Point2D;
use geom::size::Size2D;
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
/// 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> {
// Spaces must be squares and powers of 2, so expand the space until it is
let longer = width.max(&height);
let num_tiles = uint::div_ceil(longer, tile_size);
let power_of_two = uint::next_power_of_two(num_tiles);
let num_tiles = div_ceil(longer, tile_size);
let power_of_two = next_power_of_two(num_tiles);
let size = power_of_two * tile_size;
Quadtree {
@ -211,9 +212,9 @@ impl<T> QuadtreeNode<T> {
let index = self.get_quadrant(x,y) as int;
match self.quadrants[index] {
None => {
// calculate where the new tile should go
// Calculate where the new tile should go
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_pixel = (new_size_page * scale).ceil() as uint;