[librsvg: 12/15] Rename DrawingCtx.draw_path to draw_shape and pass it a Shape
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 12/15] Rename DrawingCtx.draw_path to draw_shape and pass it a Shape
- Date: Tue, 1 Dec 2020 22:17:53 +0000 (UTC)
commit 02e279d3973dd9deb0c20b9ec8d8285ccd0d35ae
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 1 15:54:40 2020 -0600
Rename DrawingCtx.draw_path to draw_shape and pass it a Shape
src/drawing_ctx.rs | 16 ++++++++--------
src/shapes.rs | 13 +++----------
2 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 47269070..78491169 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -32,7 +32,7 @@ use crate::property_defs::{
StrokeDasharray, StrokeLinecap, StrokeLinejoin, TextRendering,
};
use crate::rect::Rect;
-use crate::shapes::Markers;
+use crate::shapes::{Markers, Shape};
use crate::structure::Mask;
use crate::surface_utils::{
shared_surface::ExclusiveImageSurface, shared_surface::SharedImageSurface,
@@ -1288,23 +1288,23 @@ impl DrawingCtx {
Ok(())
}
- pub fn draw_path(
+ pub fn draw_shape(
&mut self,
- path: &Path,
+ shape: &Shape,
node: &Node,
acquired_nodes: &mut AcquiredNodes<'_>,
values: &ComputedValues,
- markers: Markers,
clipping: bool,
) -> Result<BoundingBox, RenderingError> {
- if path.is_empty() {
+ if shape.path.is_empty() {
return Ok(self.empty_bbox());
}
self.with_discrete_layer(node, acquired_nodes, values, clipping, &mut |an, dc| {
let cr = dc.cr.clone();
let transform = dc.get_transform();
- let mut path_helper = PathHelper::new(&cr, transform, path, values.stroke_line_cap());
+ let mut path_helper =
+ PathHelper::new(&cr, transform, &shape.path, values.stroke_line_cap());
if clipping {
cr.set_fill_rule(cairo::FillRule::from(values.clip_rule()));
@@ -1337,9 +1337,9 @@ impl DrawingCtx {
dc.fill(&cr, an, values, &bbox, current_color)?;
}
}
- PaintTarget::Markers if markers == Markers::Yes => {
+ PaintTarget::Markers if shape.markers == Markers::Yes => {
path_helper.unset();
- marker::render_markers_for_path(path, dc, an, values, clipping)?;
+ marker::render_markers_for_path(&shape.path, dc, an, values, clipping)?;
}
_ => {}
}
diff --git a/src/shapes.rs b/src/shapes.rs
index f86ce635..6fb3ba20 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -26,8 +26,8 @@ pub enum Markers {
}
pub struct Shape {
- path: Rc<SvgPath>,
- markers: Markers,
+ pub path: Rc<SvgPath>,
+ pub markers: Markers,
}
impl Shape {
@@ -43,14 +43,7 @@ impl Shape {
draw_ctx: &mut DrawingCtx,
clipping: bool,
) -> Result<BoundingBox, RenderingError> {
- draw_ctx.draw_path(
- &self.path,
- node,
- acquired_nodes,
- values,
- self.markers,
- clipping,
- )
+ draw_ctx.draw_shape(self, node, acquired_nodes, values, clipping)
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]