mirror of
https://github.com/servo/servo.git
synced 2025-07-08 07:53:40 +01:00
compositor: only UpdateImages
that accepts SmallVec
and add helpers for single image (#37730)
Before we only offered helper to add single image (no update or delete) that got special IPC message, now we simplify this by offering all ops helpers for dealing with single image (that happens most of the time), that simply uses `update_images` under the hood. We also optimize for this use case by using `SmallVec<[ImageUpdate; 1]>` to avoid alloc. Testing: Just refactor, but code is covered by WPT tests --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
3c16db2642
commit
4dded465a4
9 changed files with 36 additions and 42 deletions
|
@ -23,7 +23,7 @@ use canvas_traits::webgl::{
|
|||
WebGLVersion, WebGLVertexArrayId, YAxisTreatment,
|
||||
};
|
||||
use compositing_traits::{
|
||||
CrossProcessCompositorApi, ImageUpdate, SerializableImageData, WebrenderExternalImageRegistry,
|
||||
CrossProcessCompositorApi, SerializableImageData, WebrenderExternalImageRegistry,
|
||||
WebrenderImageHandlerType,
|
||||
};
|
||||
use euclid::default::Size2D;
|
||||
|
@ -719,8 +719,7 @@ impl WebGLThread {
|
|||
fn remove_webgl_context(&mut self, context_id: WebGLContextId) {
|
||||
// Release webrender image keys.
|
||||
if let Some(info) = self.cached_context_info.remove(&context_id) {
|
||||
self.compositor_api
|
||||
.update_images(vec![ImageUpdate::DeleteImage(info.image_key)]);
|
||||
self.compositor_api.delete_image(info.image_key);
|
||||
}
|
||||
|
||||
// We need to make the context current so its resources can be disposed of.
|
||||
|
@ -929,11 +928,7 @@ impl WebGLThread {
|
|||
let image_data = Self::external_image_data(context_id, image_buffer_kind);
|
||||
|
||||
self.compositor_api
|
||||
.update_images(vec![ImageUpdate::UpdateImage(
|
||||
info.image_key,
|
||||
descriptor,
|
||||
image_data,
|
||||
)]);
|
||||
.update_image(info.image_key, descriptor, image_data);
|
||||
}
|
||||
|
||||
/// Helper function to create a `ImageDescriptor`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue