mirror of
https://github.com/penpot/penpot.git
synced 2025-06-16 21:01:38 +02:00
🐛 Fix stroke image rendering (#6189)
This commit is contained in:
parent
76ffc2d268
commit
3d7479f9aa
2 changed files with 9 additions and 3 deletions
|
@ -451,7 +451,13 @@ fn draw_image_stroke_in_container(
|
||||||
// Compute scaled rect and clip to it
|
// Compute scaled rect and clip to it
|
||||||
let dest_rect = calculate_scaled_rect(size, container, stroke.delta());
|
let dest_rect = calculate_scaled_rect(size, container, stroke.delta());
|
||||||
canvas.clip_rect(dest_rect, skia::ClipOp::Intersect, antialias);
|
canvas.clip_rect(dest_rect, skia::ClipOp::Intersect, antialias);
|
||||||
canvas.draw_image_rect(image.unwrap(), None, dest_rect, &image_paint);
|
canvas.draw_image_rect_with_sampling_options(
|
||||||
|
image.unwrap(),
|
||||||
|
None,
|
||||||
|
dest_rect,
|
||||||
|
render_state.sampling_options,
|
||||||
|
&image_paint,
|
||||||
|
);
|
||||||
|
|
||||||
// Clear outer stroke for paths if necessary. When adding an outer stroke we need to empty the stroke added too in the inner area.
|
// Clear outer stroke for paths if necessary. When adding an outer stroke we need to empty the stroke added too in the inner area.
|
||||||
if let Type::Path(p) = &shape.shape_type {
|
if let Type::Path(p) = &shape.shape_type {
|
||||||
|
|
|
@ -116,8 +116,8 @@ impl Stroke {
|
||||||
pub fn delta(&self) -> f32 {
|
pub fn delta(&self) -> f32 {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
StrokeKind::InnerStroke => 0.,
|
StrokeKind::InnerStroke => 0.,
|
||||||
StrokeKind::CenterStroke => self.width / 2.,
|
StrokeKind::CenterStroke => self.width,
|
||||||
StrokeKind::OuterStroke => self.width,
|
StrokeKind::OuterStroke => self.width * 2.,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue