mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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
|
@ -9,7 +9,7 @@ use std::sync::{Arc, Mutex};
|
|||
|
||||
use arrayvec::ArrayVec;
|
||||
use compositing_traits::{
|
||||
CrossProcessCompositorApi, ImageUpdate, SerializableImageData, WebrenderExternalImageApi,
|
||||
CrossProcessCompositorApi, SerializableImageData, WebrenderExternalImageApi,
|
||||
WebrenderImageSource,
|
||||
};
|
||||
use euclid::default::Size2D;
|
||||
|
@ -310,7 +310,7 @@ impl ContextData {
|
|||
warn!("Unable to send FreeBuffer({:?}) ({:?})", buffer_id, e);
|
||||
};
|
||||
}
|
||||
compositor_api.update_images(vec![ImageUpdate::DeleteImage(self.image_key)]);
|
||||
compositor_api.delete_image(self.image_key);
|
||||
}
|
||||
|
||||
/// Returns true if presentation id was updated (was newer)
|
||||
|
@ -421,12 +421,11 @@ impl crate::WGPU {
|
|||
};
|
||||
|
||||
if needs_image_update {
|
||||
self.compositor_api
|
||||
.update_images(vec![ImageUpdate::UpdateImage(
|
||||
context_data.image_key,
|
||||
context_data.image_desc.0,
|
||||
SerializableImageData::External(context_data.image_data),
|
||||
)]);
|
||||
self.compositor_api.update_image(
|
||||
context_data.image_key,
|
||||
context_data.image_desc.0,
|
||||
SerializableImageData::External(context_data.image_data),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,11 +573,11 @@ fn update_wr_image(
|
|||
return;
|
||||
};
|
||||
let old_presentation_buffer = swap_chain.data.replace(presentation_buffer);
|
||||
compositor_api.update_images(vec![ImageUpdate::UpdateImage(
|
||||
compositor_api.update_image(
|
||||
context_data.image_key,
|
||||
context_data.image_desc.0,
|
||||
SerializableImageData::External(context_data.image_data),
|
||||
)]);
|
||||
);
|
||||
if let Some(old_presentation_buffer) = old_presentation_buffer {
|
||||
context_data.unmap_old_buffer(old_presentation_buffer)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue