Checkpoint: start rendering images

This commit is contained in:
Antonio Scandurra
2023-10-04 15:03:21 +02:00
parent 5c750b6880
commit 1816ab95a0
11 changed files with 231 additions and 77 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
use std::borrow::Cow;
use crate::{
AtlasKey, AtlasTextureId, AtlasTile, Bounds, DevicePixels, PlatformAtlas, Point, Size,
};
@@ -31,10 +33,10 @@ struct MetalAtlasState {
}
impl PlatformAtlas for MetalAtlas {
fn get_or_insert_with(
fn get_or_insert_with<'a>(
&self,
key: &AtlasKey,
build: &mut dyn FnMut() -> Result<(Size<DevicePixels>, Vec<u8>)>,
build: &mut dyn FnMut() -> Result<(Size<DevicePixels>, Cow<'a, [u8]>)>,
) -> Result<AtlasTile> {
let mut lock = self.0.lock();
if let Some(tile) = lock.tiles_by_key.get(key) {