--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -634,62 +634,70 @@ pub unsafe extern "C" fn wr_api_delete(d
#[no_mangle]
pub extern "C" fn wr_api_add_image(dh: &mut DocumentHandle,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
bytes: ByteSlice) {
assert!(unsafe { is_in_compositor_thread() });
let copied_bytes = bytes.as_slice().to_owned();
- dh.api.add_image(image_key,
- descriptor.into(),
- ImageData::new(copied_bytes),
- None);
+ let mut resources = ResourceUpdates::new();
+ resources.add_image(image_key,
+ descriptor.into(),
+ ImageData::new(copied_bytes),
+ None);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_add_blob_image(dh: &mut DocumentHandle,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
bytes: ByteSlice) {
assert!(unsafe { is_in_compositor_thread() });
let copied_bytes = bytes.as_slice().to_owned();
- dh.api.add_image(image_key,
- descriptor.into(),
- ImageData::new_blob_image(copied_bytes),
- None);
+ let mut resources = ResourceUpdates::new();
+ resources.add_image(image_key,
+ descriptor.into(),
+ ImageData::new_blob_image(copied_bytes),
+ None);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_add_external_image(dh: &mut DocumentHandle,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
external_image_id: WrExternalImageId,
buffer_type: WrExternalImageBufferType,
channel_index: u8) {
assert!(unsafe { is_in_compositor_thread() });
- dh.api.add_image(image_key,
- descriptor.into(),
- ImageData::External(ExternalImageData {
+ let mut resources = ResourceUpdates::new();
+ resources.add_image(image_key,
+ descriptor.into(),
+ ImageData::External(ExternalImageData {
id: external_image_id.into(),
channel_index: channel_index,
image_type: buffer_type,
}),
- None);
+ None);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_update_image(dh: &mut DocumentHandle,
key: WrImageKey,
descriptor: &WrImageDescriptor,
bytes: ByteSlice) {
assert!(unsafe { is_in_compositor_thread() });
let copied_bytes = bytes.as_slice().to_owned();
- dh.api.update_image(key, descriptor.into(), ImageData::new(copied_bytes), None);
+ let mut resources = ResourceUpdates::new();
+ resources.update_image(key, descriptor.into(), ImageData::new(copied_bytes), None);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_update_external_image(
dh: &mut DocumentHandle,
key: WrImageKey,
descriptor: &WrImageDescriptor,
external_image_id: WrExternalImageId,
@@ -701,39 +709,45 @@ pub extern "C" fn wr_api_update_external
let data = ImageData::External(
ExternalImageData {
id: external_image_id.into(),
channel_index,
image_type,
}
);
- dh.api.update_image(key, descriptor.into(), data, None);
+ let mut resources = ResourceUpdates::new();
+ resources.update_image(key, descriptor.into(), data, None);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_update_blob_image(dh: &mut DocumentHandle,
image_key: WrImageKey,
descriptor: &WrImageDescriptor,
bytes: ByteSlice) {
assert!(unsafe { is_in_compositor_thread() });
let copied_bytes = bytes.as_slice().to_owned();
- dh.api.update_image(
- image_key,
- descriptor.into(),
- ImageData::new_blob_image(copied_bytes),
- None
+ let mut resources = ResourceUpdates::new();
+ resources.update_image(
+ image_key,
+ descriptor.into(),
+ ImageData::new_blob_image(copied_bytes),
+ None
);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_delete_image(dh: &mut DocumentHandle,
key: WrImageKey) {
assert!(unsafe { is_in_compositor_thread() });
- dh.api.delete_image(key)
+ let mut resources = ResourceUpdates::new();
+ resources.delete_image(key);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_set_root_pipeline(dh: &mut DocumentHandle,
pipeline_id: WrPipelineId) {
dh.api.set_root_pipeline(dh.document_id, pipeline_id);
}
@@ -774,32 +788,34 @@ pub unsafe extern "C" fn wr_api_set_root
dl_vec.extend_from_slice(dl_slice);
let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
dh.api.set_display_list(dh.document_id,
epoch,
color,
LayoutSize::new(viewport_width, viewport_height),
(pipeline_id, content_size.into(), dl),
- preserve_frame_state);
+ preserve_frame_state,
+ ResourceUpdates::new());
}
#[no_mangle]
pub unsafe extern "C" fn wr_api_clear_root_display_list(dh: &mut DocumentHandle,
epoch: WrEpoch,
pipeline_id: WrPipelineId) {
let preserve_frame_state = true;
let frame_builder = WebRenderFrameBuilder::new(pipeline_id, LayoutSize::zero());
dh.api.set_display_list(dh.document_id,
epoch,
None,
LayoutSize::new(0.0, 0.0),
frame_builder.dl_builder.finalize(),
- preserve_frame_state);
+ preserve_frame_state,
+ ResourceUpdates::new());
}
#[no_mangle]
pub extern "C" fn wr_api_generate_frame(dh: &mut DocumentHandle) {
dh.api.generate_frame(dh.document_id, None);
}
#[no_mangle]
@@ -857,24 +873,28 @@ pub extern "C" fn wr_api_add_raw_font(dh
buffer_size: usize,
index: u32) {
assert!(unsafe { is_in_compositor_thread() });
let font_slice = make_slice(font_buffer, buffer_size);
let mut font_vector = Vec::new();
font_vector.extend_from_slice(font_slice);
- dh.api.add_raw_font(key, font_vector, index);
+ let mut resources = ResourceUpdates::new();
+ resources.add_raw_font(key, font_vector, index);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub extern "C" fn wr_api_delete_font(dh: &mut DocumentHandle,
key: WrFontKey) {
assert!(unsafe { is_in_compositor_thread() });
- dh.api.delete_font(key);
+ let mut resources = ResourceUpdates::new();
+ resources.delete_font(key);
+ dh.api.update_resources(resources);
}
#[no_mangle]
pub unsafe extern "C" fn wr_api_get_namespace(dh: &mut DocumentHandle) -> WrIdNamespace {
dh.api.get_namespace_id()
}
// RenderThread WIP notes: