Don't bother with the global in ImageData::get_image_data

This commit is contained in:
Anthony Ramine 2016-08-28 17:10:03 +02:00
parent 854a3dff68
commit 2400b91d05
4 changed files with 6 additions and 8 deletions

View file

@ -53,12 +53,12 @@ impl ImageData {
}
#[allow(unsafe_code)]
pub fn get_data_array(&self, global: &GlobalRef) -> Vec<u8> {
pub fn get_data_array(&self) -> Vec<u8> {
unsafe {
let cx = global.get_cx();
let mut is_shared = false;
assert!(!self.data.get().is_null());
let data: *const uint8_t =
JS_GetUint8ClampedArrayData(self.Data(cx), &mut is_shared, ptr::null()) as *const uint8_t;
JS_GetUint8ClampedArrayData(self.data.get(), &mut is_shared, ptr::null()) as *const uint8_t;
assert!(!data.is_null());
assert!(!is_shared);
let len = self.Width() * self.Height() * 4;