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

NSS/NSPR, scroll fixes, texture upload fixes, and hit testing #495

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Fix corrupted textures when resizing.

  • Loading branch information
pcwalton committed May 30, 2013
commit 02c57728c550cf43c0709f3da3a8481fd6fe8e8d
@@ -4,6 +4,7 @@

use azure::azure_hl::{DrawTarget};
use geom::rect::Rect;
use geom::size::Size2D;

pub struct LayerBuffer {
draw_target: DrawTarget,
@@ -24,6 +25,6 @@ pub struct LayerBufferSet {
/// The interface used to by the renderer to acquire draw targets for each rendered frame and
/// submit them to be drawn to the display.
pub trait Compositor {
fn paint(&self, layer_buffer_set: LayerBufferSet);
fn paint(&self, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>);
}

@@ -50,8 +50,6 @@ pub fn render_layers(layer_ref: *RenderLayer,
let width = right - x;
let height = bottom - y;

let tile_rect = Rect(Point2D(x, y), Size2D(width, height));

// Round the width up the nearest 32 pixels for DMA on the Mac.
let aligned_width = if width % 32 == 0 {
width
@@ -63,6 +61,8 @@ pub fn render_layers(layer_ref: *RenderLayer,

debug!("tile aligned_width %u", aligned_width);

let tile_rect = Rect(Point2D(x, y), Size2D(aligned_width, height));

let buffer;
// FIXME: Try harder to search for a matching tile.
// FIXME: Don't use shift; it's bad for perf. Maybe reverse and pop.
@@ -75,7 +75,7 @@ pub fn render_layers(layer_ref: *RenderLayer,

let size = Size2D(aligned_width as i32, height as i32);
// FIXME: This may not be always true.
let stride = size.width * 4;
let stride = (aligned_width as i32) * 4;

let mut data: ~[u8] = ~[0];
let offset;
@@ -162,7 +162,7 @@ impl<C: Compositor + Owned> Renderer<C> {
};

debug!("renderer: returning surface");
self.compositor.paint(layer_buffer_set);
self.compositor.paint(layer_buffer_set, render_layer.size);
}
}
}
@@ -60,8 +60,10 @@ impl CompositorTask {

/// Messages to the compositor.
pub enum Msg {
Paint(LayerBufferSet),
Exit
/// Requests that the compositor paint the given layer buffer set for the given page size.
Paint(LayerBufferSet, Size2D<uint>),
/// Requests that the compositor shut down.
Exit,
}

/// Azure surface wrapping to work with the layers infrastructure.
@@ -132,8 +134,11 @@ fn run_main_loop(port: Port<Msg>,
match port.recv() {
Exit => *done = true,

Paint(new_layer_buffer_set) => {
Paint(new_layer_buffer_set, new_size) => {
debug!("osmain: received new frame");

*page_size = Size2D(new_size.width as f32, new_size.height as f32);

let mut new_layer_buffer_set = new_layer_buffer_set;

// Iterate over the children of the container layer.
@@ -142,7 +147,6 @@ fn run_main_loop(port: Port<Msg>,
// Replace the image layer data with the buffer data. Also compute the page
// size here.
let buffers = util::replace(&mut new_layer_buffer_set.buffers, ~[]);
let mut (page_width, page_height) = (0.0f32, 0.0f32);

for buffers.each |buffer| {
let width = buffer.rect.size.width as uint;
@@ -181,10 +185,6 @@ fn run_main_loop(port: Port<Msg>,
let origin = buffer.rect.origin;
let origin = Point2D(origin.x as f32, origin.y as f32);

// Update the page width and height calculations.
page_width = page_width.max(&(origin.x + (width as f32)));
page_height = page_height.max(&(origin.y + (height as f32)));

// Set the layer's transform.
let transform = original_layer_transform.translate(origin.x,
origin.y,
@@ -193,8 +193,6 @@ fn run_main_loop(port: Port<Msg>,
image_layer.common.set_transform(transform)
}

*page_size = Size2D(page_width, page_height);

// TODO: Recycle the old buffers; send them back to the renderer to reuse if
// it wishes.

@@ -265,8 +263,8 @@ fn run_main_loop(port: Port<Msg>,

/// Implementation of the abstract `Compositor` interface.
impl Compositor for CompositorTask {
fn paint(&self, layer_buffer_set: LayerBufferSet) {
self.chan.send(Paint(layer_buffer_set))
fn paint(&self, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>) {
self.chan.send(Paint(layer_buffer_set, new_size))
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.