mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 13:39:02 +00:00
🎉 Improve plain shape calculation
This commit is contained in:
parent
f7403935c8
commit
5be887f10b
@ -22,7 +22,7 @@ pub use surfaces::{SurfaceId, Surfaces};
|
|||||||
|
|
||||||
use crate::performance;
|
use crate::performance;
|
||||||
use crate::shapes::{
|
use crate::shapes::{
|
||||||
all_with_ancestors, Blur, BlurType, Corners, Fill, Shadow, Shape, SolidColor, Stroke, Type,
|
all_with_ancestors, Blur, BlurType, Corners, Fill, Shadow, Shape, SolidColor, Type,
|
||||||
};
|
};
|
||||||
use crate::state::{ShapesPoolMutRef, ShapesPoolRef};
|
use crate::state::{ShapesPoolMutRef, ShapesPoolRef};
|
||||||
use crate::tiles::{self, PendingTiles, TileRect};
|
use crate::tiles::{self, PendingTiles, TileRect};
|
||||||
@ -1536,28 +1536,20 @@ impl RenderState {
|
|||||||
let world_offset = (mapped.x, mapped.y);
|
let world_offset = (mapped.x, mapped.y);
|
||||||
|
|
||||||
// The opacity of fills and strokes shouldn't affect the shadow,
|
// The opacity of fills and strokes shouldn't affect the shadow,
|
||||||
// so we paint everything black with the same opacity
|
// so we paint everything black with the same opacity.
|
||||||
plain_shape.to_mut().clear_fills();
|
let plain_shape_mut = plain_shape.to_mut();
|
||||||
|
plain_shape_mut.clear_fills();
|
||||||
if shape.has_fills() {
|
if shape.has_fills() {
|
||||||
plain_shape
|
plain_shape_mut.add_fill(Fill::Solid(SolidColor(skia::Color::BLACK)));
|
||||||
.to_mut()
|
|
||||||
.add_fill(Fill::Solid(SolidColor(skia::Color::BLACK)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plain_shape.to_mut().clear_strokes();
|
// Reuse existing strokes and only override their fill color.
|
||||||
for stroke in shape.strokes.iter() {
|
for stroke in plain_shape_mut.strokes.iter_mut() {
|
||||||
plain_shape.to_mut().add_stroke(Stroke {
|
stroke.fill = Fill::Solid(SolidColor(skia::Color::BLACK));
|
||||||
fill: Fill::Solid(SolidColor(skia::Color::BLACK)),
|
|
||||||
width: stroke.width,
|
|
||||||
style: stroke.style,
|
|
||||||
cap_end: stroke.cap_end,
|
|
||||||
cap_start: stroke.cap_start,
|
|
||||||
kind: stroke.kind,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plain_shape.to_mut().clear_shadows();
|
plain_shape_mut.clear_shadows();
|
||||||
plain_shape.to_mut().blur = None;
|
plain_shape_mut.blur = None;
|
||||||
|
|
||||||
let Some(drop_filter) = transformed_shadow.get_drop_shadow_filter() else {
|
let Some(drop_filter) = transformed_shadow.get_drop_shadow_filter() else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user