remove some debugging an unnecessary allocating
Some checks failed
/ test (push) Has been cancelled

This commit is contained in:
Chris Cochrun 2025-12-18 09:56:06 -06:00
parent 1240bda2b2
commit ec572a78d7
2 changed files with 19 additions and 21 deletions

View file

@ -23,9 +23,8 @@ use cosmic::{
}, },
prelude::*, prelude::*,
widget::{ widget::{
Container, Id, Row, Space, container, context_menu, Container, Id, Row, Space, container, context_menu, image,
horizontal_space, icon, image, menu, mouse_area, responsive, menu, mouse_area, responsive, scrollable, text,
scrollable, text,
}, },
}; };
use iced_video_player::{Position, Video, VideoPlayer, gst_pbutils}; use iced_video_player::{Position, Video, VideoPlayer, gst_pbutils};

View file

@ -14,7 +14,6 @@ use cosmic::{
prelude::*, prelude::*,
widget::{Image, image::Handle}, widget::{Image, image::Handle},
}; };
use rapidhash::v3::rapidhash_v3;
use resvg::{ use resvg::{
tiny_skia::{self, Pixmap}, tiny_skia::{self, Pixmap},
usvg::{Tree, fontdb}, usvg::{Tree, fontdb},
@ -251,9 +250,9 @@ impl TextSvg {
pub fn build(mut self) -> Self { pub fn build(mut self) -> Self {
// debug!("starting..."); // debug!("starting...");
let mut path = dirs::data_local_dir().unwrap(); // let mut path = dirs::data_local_dir().unwrap();
path.push(PathBuf::from("lumina")); // path.push(PathBuf::from("lumina"));
path.push(PathBuf::from("temp")); // path.push(PathBuf::from("temp"));
let shadow = if let Some(shadow) = &self.shadow { let shadow = if let Some(shadow) = &self.shadow {
format!( format!(
@ -313,18 +312,18 @@ impl TextSvg {
text text
); );
let hashed_title = rapidhash_v3(final_svg.as_bytes()); // let hashed_title = rapidhash_v3(final_svg.as_bytes());
path.push(PathBuf::from(hashed_title.to_string())); // path.push(PathBuf::from(hashed_title.to_string()));
path.set_extension("png"); // path.set_extension("png");
if path.exists() { // if path.exists() {
// debug!("cached"); // // debug!("cached");
let handle = Handle::from_path(path); // let handle = Handle::from_path(path);
self.handle = Some(handle); // self.handle = Some(handle);
return self; // return self;
} // }
debug!("text string built..."); // debug!("text string built...");
let resvg_tree = Tree::from_data( let resvg_tree = Tree::from_data(
final_svg.as_bytes(), final_svg.as_bytes(),
&resvg::usvg::Options { &resvg::usvg::Options {
@ -333,16 +332,16 @@ impl TextSvg {
}, },
) )
.expect("Woops mama"); .expect("Woops mama");
debug!("parsed"); // debug!("parsed");
let transform = tiny_skia::Transform::default(); let transform = tiny_skia::Transform::default();
let mut pixmap = let mut pixmap =
Pixmap::new(size.width as u32, size.height as u32) Pixmap::new(size.width as u32, size.height as u32)
.expect("opops"); .expect("opops");
resvg::render(&resvg_tree, transform, &mut pixmap.as_mut()); resvg::render(&resvg_tree, transform, &mut pixmap.as_mut());
debug!("rendered"); // debug!("rendered");
// let _ = pixmap.save_png(&path); // let _ = pixmap.save_png(&path);
debug!("saved"); // debug!("saved");
// let handle = Handle::from_path(path); // let handle = Handle::from_path(path);
let handle = Handle::from_rgba( let handle = Handle::from_rgba(
size.width as u32, size.width as u32,
@ -350,7 +349,7 @@ impl TextSvg {
pixmap.take(), pixmap.take(),
); );
self.handle = Some(handle); self.handle = Some(handle);
debug!("stored"); // debug!("stored");
self self
} }