mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Avoid a byte swap roundtrip
This commit is contained in:
parent
93fbc1575f
commit
fef04c65f6
2 changed files with 3 additions and 6 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue