mirror of https://github.com/lapce/lapce.git
cache logo svg
This commit is contained in:
parent
9d3005d9d4
commit
43e5266562
|
@ -15,7 +15,7 @@
|
|||
use crate::signature::SignatureState;
|
||||
use crate::split::LapceSplitNew;
|
||||
use crate::state::LapceWorkspace;
|
||||
use crate::svg::{file_svg_new, get_svg};
|
||||
use crate::svg::{file_svg_new, get_svg, logo_svg};
|
||||
use crate::theme::OldLapceTheme;
|
||||
use crate::{buffer::get_word_property, state::LapceFocus};
|
||||
use crate::{buffer::matching_char, data::LapceEditorViewData};
|
||||
|
@ -4166,7 +4166,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
|
|||
);
|
||||
}
|
||||
LapceEditorViewContent::None => {
|
||||
let svg = Svg::from_str(LOGO).unwrap();
|
||||
let svg = logo_svg();
|
||||
let size = ctx.size();
|
||||
let svg_size = 100.0;
|
||||
let rect = Size::ZERO
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
use parking_lot::Mutex;
|
||||
use usvg;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::config::{Config, LOGO};
|
||||
|
||||
pub const ICONS_DIR: Dir = include_dir!("../icons");
|
||||
lazy_static! {
|
||||
|
@ -41,6 +41,16 @@ fn get_svg(&self, name: &str) -> Option<Svg> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn logo_svg() -> Svg {
|
||||
let name = "lapce_logo";
|
||||
let mut svgs = SVG_STORE.svgs.lock();
|
||||
if !svgs.contains_key(name) {
|
||||
let svg = Svg::from_str(LOGO).ok();
|
||||
svgs.insert(name.to_string(), svg);
|
||||
}
|
||||
svgs.get(name).map(|s| s.clone()).unwrap().unwrap()
|
||||
}
|
||||
|
||||
pub fn get_svg(name: &str) -> Option<Svg> {
|
||||
SVG_STORE.get_svg(name)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue