Permalink
Browse files

Auto merge of #21711 - servo:webgl, r=<try>

Some fixes to canvas stuff

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21711)
<!-- Reviewable:end -->
  • Loading branch information...
bors-servo committed Sep 14, 2018
2 parents 0a2c61d + 3528ef3 commit f0c77a9a1c782ca88c5485584c1c93bc17509286
@@ -729,7 +729,7 @@ fn crop_image(
/// smoothing_enabled: It determines if smoothing is applied to the image result
fn write_image(
draw_target: &DrawTarget,
mut image_data: Vec<u8>,
image_data: Vec<u8>,
image_size: Size2D<f64>,
dest_rect: Rect<f64>,
smoothing_enabled: bool,
@@ -740,8 +740,6 @@ fn write_image(
return
}
let image_rect = Rect::new(Point2D::zero(), image_size);
// rgba -> bgra
byte_swap(&mut image_data);
// From spec https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
// When scaling up, if the imageSmoothingEnabled attribute is set to true, the user agent should attempt
@@ -132,12 +132,13 @@ impl<'a> CanvasPaintThread <'a> {
self.canvas(canvas_id).is_point_in_path(x, y, fill_rule, chan)
},
Canvas2dMsg::DrawImage(
imagedata,
mut imagedata,
image_size,
dest_rect,
source_rect,
smoothing_enabled,
) => {
byte_swap(&mut imagedata);
self.canvas(canvas_id).draw_image(
imagedata.into(),
image_size,
@@ -169,8 +170,6 @@ impl<'a> CanvasPaintThread <'a> {
let mut image_data = self.canvas(canvas_id).read_pixels(
source_rect.to_i32(),
image_size);
// TODO: avoid double byte_swap.
byte_swap(&mut image_data);
self.canvas(other_canvas_id).draw_image(
image_data.into(),
source_rect.size,
Oops, something went wrong.

0 comments on commit f0c77a9

Please sign in to comment.