mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Avoid copying pixels in ctx.putImageData sometimes
This commit is contained in:
parent
19f40cdf0b
commit
75e6f5dfaa
6 changed files with 53 additions and 41 deletions
|
@ -369,13 +369,14 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
// Step 3.
|
||||
let raw_data = match *self.context.borrow() {
|
||||
Some(CanvasContext::Context2d(ref context)) => {
|
||||
// FIXME(nox): This shouldn't go through ImageData etc.
|
||||
let image_data = context.GetImageData(
|
||||
Finite::wrap(0f64),
|
||||
Finite::wrap(0f64),
|
||||
Finite::wrap(self.Width() as f64),
|
||||
Finite::wrap(self.Height() as f64),
|
||||
)?;
|
||||
image_data.get_data_array()
|
||||
image_data.to_vec()
|
||||
},
|
||||
Some(CanvasContext::WebGL(ref context)) => {
|
||||
match context.get_image_data(self.Width(), self.Height()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue