diff --git a/src/utilities/stable-hashing.jl b/src/utilities/stable-hashing.jl index e5b52911772..b40c61cac36 100644 --- a/src/utilities/stable-hashing.jl +++ b/src/utilities/stable-hashing.jl @@ -1,9 +1,9 @@ using CRC32c # Seems like crc32c is slow enough, that it's worthwhile to memoize the hashes -const MEMOIZED_HASHES = Dict{Any,UInt32}() +const MEMOIZED_HASHES = Dict{Tuple{UInt64,String},UInt32}() -function fast_stable_hash(x) +function fast_stable_hash(x::Tuple{UInt64,String}) return get!(MEMOIZED_HASHES, x) do return hash_crc32(x) end diff --git a/src/utilities/texture_atlas.jl b/src/utilities/texture_atlas.jl index e7afaad9de7..8882f8f9995 100644 --- a/src/utilities/texture_atlas.jl +++ b/src/utilities/texture_atlas.jl @@ -298,6 +298,7 @@ function insert_glyph!(atlas::TextureAtlas, path::BezierPath) return insert_glyph!(atlas, fast_stable_hash(path), path) end + function insert_glyph!(atlas::TextureAtlas, hash::UInt32, path_or_glyp::Union{BezierPath, Tuple{UInt64, NativeFont}}) return get!(atlas.mapping, hash) do uv_pixel = render(atlas, path_or_glyp)