mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 23:38:06 +08:00
Improve rendering efficiency and add caching (#95)
Fixes #84 *Reduce heap allocations * Add caching for rendering svgs * Deduplicate UpdateCanvas Responses
This commit is contained in:
committed by
Keavon Chambers
parent
457c465342
commit
fc10575dfa
@@ -3,6 +3,8 @@ use crate::shape_points;
|
||||
use super::style;
|
||||
use super::LayerData;
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Shape {
|
||||
shape: shape_points::ShapePoints,
|
||||
@@ -19,7 +21,7 @@ impl Shape {
|
||||
}
|
||||
|
||||
impl LayerData for Shape {
|
||||
fn render(&self) -> String {
|
||||
format!(r#"<polygon points="{}" {} />"#, self.shape, self.style.render(),)
|
||||
fn render(&mut self, svg: &mut String) {
|
||||
let _ = write!(svg, r#"<polygon points="{}" {} />"#, self.shape, self.style.render(),);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user