auto merge of #5354 : Ms2ger/servo/canvas, r=saneyuki

This commit is contained in:
bors-servo 2015-03-25 03:45:48 -06:00
commit 004e12c89d

View file

@ -64,7 +64,7 @@ impl<'a> CanvasPaintTask<'a> {
//start offset of the copyable rectangle //start offset of the copyable rectangle
let mut src = (src_read_rect.origin.y * stride + src_read_rect.origin.x * 4) as usize; let mut src = (src_read_rect.origin.y * stride + src_read_rect.origin.x * 4) as usize;
//copy the data to the destination vector //copy the data to the destination vector
for _ in range(0, src_read_rect.size.height) { for _ in 0..src_read_rect.size.height {
let row = &src_data[src .. src + (4 * src_read_rect.size.width) as usize]; let row = &src_data[src .. src + (4 * src_read_rect.size.width) as usize];
image_data.push_all(row); image_data.push_all(row);
src += stride as usize; src += stride as usize;
@ -77,7 +77,7 @@ impl<'a> CanvasPaintTask<'a> {
/// source_rect: the area of the image data to be written /// source_rect: the area of the image data to be written
/// dest_rect: The area of the canvas where the imagedata will be copied /// dest_rect: The area of the canvas where the imagedata will be copied
/// smoothing_enabled: if smoothing is applied to the copied pixels /// smoothing_enabled: if smoothing is applied to the copied pixels
fn write_pixels(&self, imagedata: &Vec<u8>, fn write_pixels(&self, imagedata: &[u8],
image_size: Size2D<i32>, image_size: Size2D<i32>,
source_rect: Rect<i32>, source_rect: Rect<i32>,
dest_rect: Rect<i32>, dest_rect: Rect<i32>,
@ -92,7 +92,7 @@ impl<'a> CanvasPaintTask<'a> {
Filter::Point Filter::Point
}; };
let source_surface = self.drawtarget.create_source_surface_from_data(imagedata.as_slice(), let source_surface = self.drawtarget.create_source_surface_from_data(imagedata,
image_size, image_size.width * 4, SurfaceFormat::B8G8R8A8); image_size, image_size.width * 4, SurfaceFormat::B8G8R8A8);
let draw_surface_options = DrawSurfaceOptions::new(filter, true); let draw_surface_options = DrawSurfaceOptions::new(filter, true);