Skip to content

Commit

Permalink
Use crate::HashMap in SwashCache
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Dec 20, 2023
1 parent 430b3ab commit 19b4d83
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/swash.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -93,8 +89,8 @@ fn swash_outline_commands(
/// Cache for rasterizing with the swash scaler
pub struct SwashCache {
context: ScaleContext,
pub image_cache: Map<CacheKey, Option<SwashImage>>,
pub outline_command_cache: Map<CacheKey, Option<Vec<swash::zeno::Command>>>,
pub image_cache: HashMap<CacheKey, Option<SwashImage>>,
pub outline_command_cache: HashMap<CacheKey, Option<Vec<swash::zeno::Command>>>,
}

impl fmt::Debug for SwashCache {
Expand All @@ -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(),
}
}

Expand Down

0 comments on commit 19b4d83

Please sign in to comment.