mirror of
https://github.com/penpot/penpot.git
synced 2025-05-15 23:06:37 +02:00
♻️ Decouple render and shapes
This commit is contained in:
parent
7b1934dcb6
commit
c7c43d6313
2 changed files with 50 additions and 29 deletions
|
@ -1,18 +1,11 @@
|
|||
use skia_safe as skia;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::{draw_image_in_container, Fill, Kind, Shape};
|
||||
use crate::math::Rect;
|
||||
use crate::render::{ImageStore, Renderable};
|
||||
|
||||
impl Renderable for Shape {
|
||||
fn blend_mode(&self) -> crate::render::BlendMode {
|
||||
self.blend_mode
|
||||
}
|
||||
|
||||
fn opacity(&self) -> f32 {
|
||||
self.opacity
|
||||
}
|
||||
|
||||
fn render(&self, surface: &mut skia_safe::Surface, images: &ImageStore) -> Result<(), String> {
|
||||
let mut transform = skia::Matrix::new_identity();
|
||||
let (translate_x, translate_y) = self.translation();
|
||||
|
@ -49,6 +42,30 @@ impl Renderable for Shape {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn blend_mode(&self) -> crate::render::BlendMode {
|
||||
self.blend_mode
|
||||
}
|
||||
|
||||
fn opacity(&self) -> f32 {
|
||||
self.opacity
|
||||
}
|
||||
|
||||
fn hidden(&self) -> bool {
|
||||
self.hidden
|
||||
}
|
||||
|
||||
fn bounds(&self) -> Rect {
|
||||
self.selrect
|
||||
}
|
||||
|
||||
fn clip(&self) -> bool {
|
||||
self.clip_content
|
||||
}
|
||||
|
||||
fn children_ids(&self) -> Vec<Uuid> {
|
||||
self.children.clone()
|
||||
}
|
||||
}
|
||||
|
||||
fn render_fill(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue