Bug 1319284 - create a WR imageKey from an external texture. r=nical?

add wr_add_external_image_texture() func to create a WR imageKey from an external texture.

MozReview-Commit-ID: DJUsd15EKlw
This commit is contained in:
JerryShih 2016-11-29 11:56:18 +08:00
Родитель 7279a0ba4e
Коммит 3ba2bba5f2
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -470,6 +470,11 @@ pub extern fn wr_add_image(window: &mut WrWindowState, width: u32, height: u32,
window.api.add_image(width, height, stride_option, format, ImageData::new(bytes))
}
#[no_mangle]
pub extern fn wr_add_external_image_texture(window: &mut WrWindowState, width: u32, height: u32, format: ImageFormat, external_image_id: u64) -> ImageKey {
window.api.add_image(width, height, None, format, ImageData::External(ExternalImageId(external_image_id)))
}
#[no_mangle]
pub extern fn wr_update_image(window: &mut WrWindowState, key: ImageKey, width: u32, height: u32, format: ImageFormat, bytes: * const u8, size: usize) {
let bytes = unsafe { slice::from_raw_parts(bytes, size).to_owned() };

Просмотреть файл

@ -111,6 +111,17 @@ wr_add_image(wrwindowstate* wrWindow, uint32_t width, uint32_t height,
uint32_t stride, WRImageFormat format, uint8_t *bytes, size_t size)
WR_FUNC;
WR_INLINE WRImageKey
wr_add_external_image_texture(wrwindowstate* wrWindow, uint32_t width, uint32_t height,
WRImageFormat format, uint64_t external_image_id)
WR_FUNC;
//TODO(Jerry): handle shmem in WR
//// WR_INLINE WRImageKey
//// wr_add_external_image_buffer(wrwindowstate* wrWindow, uint32_t width, uint32_t height,
//// uint32_t stride, WRImageFormat format, uint8_t *bytes, size_t size)
//// WR_FUNC;
WR_INLINE void
wr_update_image(wrwindowstate* wrWindow, WRImageKey key,
uint32_t width, uint32_t height,