[librsvg: 5/6] draw_path - Separate clipping from non-clipping code
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/6] draw_path - Separate clipping from non-clipping code
- Date: Wed, 2 Sep 2020 00:49:38 +0000 (UTC)
commit 44b7c62d65c66a3b1d2e48fdc0cfa391c90e2665
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 1 19:46:43 2020 -0500
draw_path - Separate clipping from non-clipping code
rsvg_internals/src/drawing_ctx.rs | 51 +++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 26 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 87e85291..e73d134c 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -1227,43 +1227,42 @@ impl DrawingCtx {
let cr = dc.cr.clone();
let is_square_linecap = values.stroke_line_cap() == StrokeLinecap::Square;
- cr.set_antialias(cairo::Antialias::from(values.shape_rendering()));
- dc.setup_cr_for_stroke(&cr, values);
-
- let bbox = if clipping {
+ if clipping {
cr.set_fill_rule(cairo::FillRule::from(values.clip_rule()));
path.to_cairo(&cr, is_square_linecap)?;
- dc.empty_bbox()
+ Ok(dc.empty_bbox())
} else {
+ let current_color = values.color().0;
+
+ cr.set_antialias(cairo::Antialias::from(values.shape_rendering()));
+ dc.setup_cr_for_stroke(&cr, values);
+
cr.set_fill_rule(cairo::FillRule::from(values.fill_rule()));
path.to_cairo(&cr, is_square_linecap)?;
let bbox = compute_stroke_and_fill_box(&cr, &values);
cr.new_path();
- bbox
- };
- let current_color = values.color().0;
-
- for &target in &values.paint_order().targets {
- match target {
- PaintTarget::Fill if !clipping => {
- path.to_cairo(&cr, is_square_linecap)?;
- dc.fill(&cr, an, values, &bbox, current_color)?;
- cr.new_path();
- }
- PaintTarget::Stroke if !clipping => {
- path.to_cairo(&cr, is_square_linecap)?;
- dc.stroke(&cr, an, values, &bbox, current_color)?;
- cr.new_path();
- }
- PaintTarget::Markers if markers == Markers::Yes => {
- marker::render_markers_for_path(path, dc, an, values, clipping)?;
+ for &target in &values.paint_order().targets {
+ match target {
+ PaintTarget::Fill if !clipping => {
+ path.to_cairo(&cr, is_square_linecap)?;
+ dc.fill(&cr, an, values, &bbox, current_color)?;
+ cr.new_path();
+ }
+ PaintTarget::Stroke if !clipping => {
+ path.to_cairo(&cr, is_square_linecap)?;
+ dc.stroke(&cr, an, values, &bbox, current_color)?;
+ cr.new_path();
+ }
+ PaintTarget::Markers if markers == Markers::Yes => {
+ marker::render_markers_for_path(path, dc, an, values, clipping)?;
+ }
+ _ => {}
}
- _ => {}
}
- }
- Ok(bbox)
+ Ok(bbox)
+ }
})
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]