mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00
janitor: Use SharedString instead of String in GL renderer image cache
We can avoid a string copy.
This commit is contained in:
parent
1d8cb0506b
commit
22af9c0a33
1 changed files with 2 additions and 2 deletions
|
@ -462,7 +462,7 @@ impl CachedImage {
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Debug, derive_more::From)]
|
#[derive(PartialEq, Eq, Hash, Debug, derive_more::From)]
|
||||||
pub enum ImageCacheKey {
|
pub enum ImageCacheKey {
|
||||||
Path(String),
|
Path(SharedString),
|
||||||
EmbeddedData(by_address::ByAddress<&'static [u8]>),
|
EmbeddedData(by_address::ByAddress<&'static [u8]>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ impl ImageCacheKey {
|
||||||
if path.is_empty() {
|
if path.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
path.to_string().into()
|
path.clone().into()
|
||||||
}
|
}
|
||||||
ImageInner::EmbeddedData { data, format: _ } => {
|
ImageInner::EmbeddedData { data, format: _ } => {
|
||||||
by_address::ByAddress(data.as_slice()).into()
|
by_address::ByAddress(data.as_slice()).into()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue