Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Checkpoint
Antonio Scandurra678235023f21
diff --git a/crates/gpui3/src/platform/mac/metal_atlas.rs b/crates/gpui3/src/platform/mac/metal_atlas.rsindex 4c9938e0ece..777d97b37f0 100644--- a/crates/gpui3/src/platform/mac/metal_atlas.rs+++ b/crates/gpui3/src/platform/mac/metal_atlas.rs@@ -27,7 +27,6 @@ impl MetalAtlas {self.0.lock().texture(id).metal_texture.clone()}- #[allow(dead_code)]pub(crate) fn allocate(&self,size: Size<DevicePixels>,@@ -35,6 +34,18 @@ impl MetalAtlas {) -> AtlasTile {self.0.lock().allocate(size, texture_kind)}++ pub(crate) fn clear_textures(&self, texture_kind: AtlasTextureKind) {+ let mut lock = self.0.lock();+ let textures = match texture_kind {+ AtlasTextureKind::Monochrome => &mut lock.monochrome_textures,+ AtlasTextureKind::Polychrome => &mut lock.polychrome_textures,+ AtlasTextureKind::Path => &mut lock.path_textures,+ };+ for texture in textures {+ texture.clear();+ }+ }}struct MetalAtlasState {@@ -59,12 +70,23 @@ impl PlatformAtlas for MetalAtlas {let tile = lock.allocate(size, key.texture_kind());let texture = lock.texture(tile.texture_id);texture.upload(tile.bounds, &bytes);+ lock.tiles_by_key.insert(key.clone(), tile.clone());Ok(tile)}}fn clear(&self) {- self.0.lock().tiles_by_key.clear();+ let mut lock = self.0.lock();+ lock.tiles_by_key.clear();+ for texture in &mut lock.monochrome_textures {+ texture.clear();+ }+ for texture in &mut lock.polychrome_textures {+ texture.clear();+ }+ for texture in &mut lock.path_textures {+ texture.clear();+ }}}@@ -153,6 +175,10 @@ struct MetalAtlasTexture {}impl MetalAtlasTexture {+ fn clear(&mut self) {+ self.allocator.clear();+ }+fn allocate(&mut self, size: Size<DevicePixels>) -> Option<AtlasTile> {let allocation = self.allocator.allocate(size.into())?;let tile = AtlasTile {diff --git a/crates/gpui3/src/platform/mac/metal_renderer.rs b/crates/gpui3/src/platform/mac/metal_renderer.rsindex 18d8410738f..c1626849f4f 100644--- a/crates/gpui3/src/platform/mac/metal_renderer.rs+++ b/crates/gpui3/src/platform/mac/metal_renderer.rs@@ -281,6 +281,7 @@ impl MetalRenderer {command_buffer.commit();command_buffer.wait_until_completed();drawable.present();+ self.sprite_atlas.clear_textures(AtlasTextureKind::Path);}fn rasterize_paths(