mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Simplify ctx.drawImage a bit
There is no need to swap between RGBA and BGRA twice.
This commit is contained in:
parent
35bf180dcb
commit
bb2101f540
2 changed files with 9 additions and 36 deletions
|
@ -7,7 +7,6 @@ use canvas_data::*;
|
|||
use canvas_traits::canvas::*;
|
||||
use euclid::Size2D;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use pixels;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
use std::thread;
|
||||
|
@ -139,13 +138,10 @@ impl<'a> CanvasPaintThread <'a> {
|
|||
source_rect,
|
||||
smoothing_enabled,
|
||||
) => {
|
||||
let data = match imagedata {
|
||||
None => vec![0; image_size.width as usize * image_size.height as usize * 4],
|
||||
Some(mut data) => {
|
||||
pixels::byte_swap_colors_inplace(&mut data);
|
||||
data.into()
|
||||
},
|
||||
};
|
||||
let data = imagedata.map_or_else(
|
||||
|| vec![0; image_size.width as usize * image_size.height as usize * 4],
|
||||
|bytes| bytes.into(),
|
||||
);
|
||||
self.canvas(canvas_id).draw_image(
|
||||
data,
|
||||
image_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue