Skip to content

Commit

Permalink
refactor(svg): rename utils to renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Mar 18, 2024
1 parent eb6dcf0 commit bf37cac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/svg/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod utils;
pub mod renderer;
5 changes: 2 additions & 3 deletions src/svg/utils.rs → src/svg/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use ksni::Icon;
use resvg::{
self,
tiny_skia::{Pixmap, Transform},
usvg::{Options, Tree},
};

use ksni::Icon;
const SVG_DATA: &str = include_str!("assets/tailscale.svg");

pub struct ResvgRenderer {
options: Options,
transform: Transform,
font_db: fontdb::Database,
}

const SVG_DATA: &str = include_str!("assets/tailscale.svg");

impl ResvgRenderer {
pub fn to_icon(&mut self, svg_str: &str) -> Icon {
let rtree = Tree::from_str(svg_str, &self.options, &self.font_db).unwrap_or_else(|e| {
Expand Down
2 changes: 1 addition & 1 deletion src/tray.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::pkexec::{get_pkexec_path, pkexec_found};
use crate::svg::utils::ResvgRenderer;
use crate::svg::renderer::ResvgRenderer;
use crate::tailscale::peer::copy_peer_ip;
use crate::tailscale::status::{get_current_status, Status};
use crate::tailscale::utils::PeerKind;
Expand Down

0 comments on commit bf37cac

Please sign in to comment.