Merge pull request #6313 from penpot/superalex-improve-images-performance-wasm

🎉 Improve images performance
This commit is contained in:
Aitor Moreno 2025-04-22 11:36:24 +02:00 committed by GitHub
commit 484772e3b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 95 additions and 225 deletions

View file

@ -146,7 +146,7 @@ impl RenderState {
}
pub fn add_image(&mut self, id: Uuid, image_data: &[u8]) -> Result<(), String> {
self.images.add(id, image_data)
self.images.add(id, image_data, &mut self.gpu_state.context)
}
pub fn has_image(&mut self, id: &Uuid) -> bool {
@ -193,9 +193,7 @@ impl RenderState {
let x = self.current_tile.unwrap().0;
let y = self.current_tile.unwrap().1;
// This caches the current surface into the corresponding tile.
self.surfaces
.cache_tile_surface((x, y), SurfaceId::Current, self.background_color);
self.surfaces.cache_current_tile_texture((x, y));
self.surfaces
.draw_cached_tile_surface(self.current_tile.unwrap(), rect);