From 19b4d8336e34073bb51b83578d3d803c8c953787 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 19 Dec 2023 17:02:28 -0700 Subject: [PATCH] Use crate::HashMap in SwashCache --- src/swash.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/swash.rs b/src/swash.rs index f4af779fb7..24fcd58606 100644 --- a/src/swash.rs +++ b/src/swash.rs @@ -1,17 +1,13 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 -#[cfg(not(feature = "std"))] -use alloc::collections::BTreeMap as Map; #[cfg(not(feature = "std"))] use alloc::vec::Vec; use core::fmt; -#[cfg(feature = "std")] -use std::collections::HashMap as Map; use swash::scale::{image::Content, ScaleContext}; use swash::scale::{Render, Source, StrikeWith}; use swash::zeno::{Format, Vector}; -use crate::{CacheKey, Color, FontSystem}; +use crate::{CacheKey, Color, FontSystem, HashMap}; pub use swash::scale::image::{Content as SwashContent, Image as SwashImage}; pub use swash::zeno::{Command, Placement}; @@ -93,8 +89,8 @@ fn swash_outline_commands( /// Cache for rasterizing with the swash scaler pub struct SwashCache { context: ScaleContext, - pub image_cache: Map>, - pub outline_command_cache: Map>>, + pub image_cache: HashMap>, + pub outline_command_cache: HashMap>>, } impl fmt::Debug for SwashCache { @@ -108,8 +104,8 @@ impl SwashCache { pub fn new() -> Self { Self { context: ScaleContext::new(), - image_cache: Map::new(), - outline_command_cache: Map::new(), + image_cache: HashMap::default(), + outline_command_cache: HashMap::default(), } }