mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Fix errors
This commit is contained in:
parent
3ad28f6714
commit
b921cd14df
1 changed files with 7 additions and 1 deletions
|
@ -15,6 +15,7 @@ use js::jsapi::{Heap, JSObject};
|
||||||
use js::rust::Runtime;
|
use js::rust::Runtime;
|
||||||
use js::typedarray::{CreateWith, Uint8ClampedArray};
|
use js::typedarray::{CreateWith, Uint8ClampedArray};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
use std::convert::TryInto;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
@ -113,7 +114,12 @@ impl ImageData {
|
||||||
let len = width * height * 4;
|
let len = width * height * 4;
|
||||||
let cx = global.get_cx();
|
let cx = global.get_cx();
|
||||||
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
|
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
|
||||||
Uint8ClampedArray::create(*cx, CreateWith::Length(len), array.handle_mut()).unwrap();
|
Uint8ClampedArray::create(
|
||||||
|
*cx,
|
||||||
|
CreateWith::Length(len.try_into().unwrap()),
|
||||||
|
array.handle_mut(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
(*imagedata).data.set(array.get());
|
(*imagedata).data.set(array.get());
|
||||||
|
|
||||||
Ok(reflect_dom_object(imagedata, global))
|
Ok(reflect_dom_object(imagedata, global))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue