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:
sagudev 2025-06-26 16:57:15 +02:00 committed by GitHub
parent 3c16db2642
commit 4dded465a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 36 additions and 42 deletions

View file

@ -200,7 +200,7 @@ impl MediaFrameRenderer {
impl VideoFrameRenderer for MediaFrameRenderer {
fn render(&mut self, frame: VideoFrame) {
let mut updates = vec![];
let mut updates = smallvec::smallvec![];
if let Some(old_image_key) = mem::replace(&mut self.very_old_frame, self.old_frame.take()) {
updates.push(ImageUpdate::DeleteImage(old_image_key));