[librsvg] Make RsvgClipPath private; provide an accessor for its only field
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Make RsvgClipPath private; provide an accessor for its only field
- Date: Thu, 30 Nov 2017 16:30:26 +0000 (UTC)
commit e5c96861042cab22d86a818fba9b341c5b19979a
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Nov 30 09:59:12 2017 -0600
Make RsvgClipPath private; provide an accessor for its only field
rsvg-cairo-clip.c | 8 ++++----
rsvg-cairo-draw.c | 8 ++------
rsvg-mask.c | 17 +++++++++++++++++
rsvg-mask.h | 9 +++------
rsvg-private.h | 3 ++-
5 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/rsvg-cairo-clip.c b/rsvg-cairo-clip.c
index 0f485ea..c50ad60 100644
--- a/rsvg-cairo-clip.c
+++ b/rsvg-cairo-clip.c
@@ -182,15 +182,15 @@ rsvg_cairo_clip_render_new (cairo_t *cr, RsvgCairoRender *parent)
void
rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox)
{
- RsvgClipPath *clip;
RsvgCairoClipRender *clip_render;
RsvgCairoRender *save = RSVG_CAIRO_RENDER (ctx->render);
cairo_matrix_t affinesave;
RsvgState *clip_path_state;
cairo_t *cr;
+ RsvgCoordUnits clip_units;
g_assert (rsvg_node_get_type (node_clip_path) == RSVG_NODE_TYPE_CLIP_PATH);
- clip = rsvg_rust_cnode_get_impl (node_clip_path);
+ clip_units = rsvg_node_clip_path_get_units (node_clip_path);
cr = save->cr;
clip_render = RSVG_CAIRO_CLIP_RENDER (rsvg_cairo_clip_render_new (cr, save));
@@ -199,7 +199,7 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
clip_path_state = rsvg_node_get_state (node_clip_path);
/* Horribly dirty hack to have the bbox premultiplied to everything */
- if (clip->units == objectBoundingBox) {
+ if (clip_units == objectBoundingBox) {
cairo_matrix_t bbtransform;
cairo_matrix_init (&bbtransform,
bbox->rect.width,
@@ -216,7 +216,7 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgNode *node_clip_path, RsvgBbox * bbox
rsvg_node_draw_children (node_clip_path, ctx, 0);
rsvg_state_pop (ctx);
- if (clip->units == objectBoundingBox)
+ if (clip_units == objectBoundingBox)
clip_path_state->affine = affinesave;
g_assert (clip_render->super.cr_stack == NULL);
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index d456a6b..c743fbf 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -655,9 +655,7 @@ rsvg_cairo_push_render_stack (RsvgDrawingCtx * ctx)
RsvgNode *node;
node = rsvg_drawing_ctx_acquire_node_of_type (ctx, rsvg_current_state (ctx)->clip_path,
RSVG_NODE_TYPE_CLIP_PATH);
if (node) {
- RsvgClipPath *clip_path = rsvg_rust_cnode_get_impl (node);
-
- switch (clip_path->units) {
+ switch (rsvg_node_clip_path_get_units (node)) {
case userSpaceOnUse:
rsvg_cairo_clip (ctx, node, NULL);
break;
@@ -733,9 +731,7 @@ rsvg_cairo_pop_render_stack (RsvgDrawingCtx * ctx)
RsvgNode *node;
node = rsvg_drawing_ctx_acquire_node_of_type (ctx, rsvg_current_state (ctx)->clip_path,
RSVG_NODE_TYPE_CLIP_PATH);
if (node) {
- RsvgClipPath *cp = rsvg_rust_cnode_get_impl (node);
-
- if (cp->units == objectBoundingBox) {
+ if (rsvg_node_clip_path_get_units (node) == objectBoundingBox) {
lateclip = node;
} else {
rsvg_drawing_ctx_release_node (ctx, node);
diff --git a/rsvg-mask.c b/rsvg-mask.c
index 664e8dc..356812d 100644
--- a/rsvg-mask.c
+++ b/rsvg-mask.c
@@ -85,6 +85,12 @@ rsvg_new_mask (const char *element_name, RsvgNode *parent)
g_free);
}
+typedef struct _RsvgClipPath RsvgClipPath;
+
+struct _RsvgClipPath {
+ RsvgCoordUnits units;
+};
+
static void
rsvg_clip_path_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag *atts)
{
@@ -121,3 +127,14 @@ rsvg_new_clip_path (const char *element_name, RsvgNode *parent)
rsvg_clip_path_draw,
g_free);
}
+
+RsvgCoordUnits
+rsvg_node_clip_path_get_units (RsvgNode *node)
+{
+ RsvgClipPath *clip_path;
+
+ g_assert (rsvg_node_get_type (node) == RSVG_NODE_TYPE_CLIP_PATH);
+
+ clip_path = rsvg_rust_cnode_get_impl (node);
+ return clip_path->units;
+}
diff --git a/rsvg-mask.h b/rsvg-mask.h
index f38e5f6..938efe8 100644
--- a/rsvg-mask.h
+++ b/rsvg-mask.h
@@ -48,14 +48,11 @@ struct _RsvgMask {
G_GNUC_INTERNAL
RsvgNode *rsvg_new_mask (const char *element_name, RsvgNode *node);
-typedef struct _RsvgClipPath RsvgClipPath;
-
-struct _RsvgClipPath {
- RsvgCoordUnits units;
-};
-
G_GNUC_INTERNAL
RsvgNode *rsvg_new_clip_path (const char *element_name, RsvgNode *node);
+G_GNUC_INTERNAL
+RsvgCoordUnits rsvg_node_clip_path_get_units (RsvgNode *node);
+
G_END_DECLS
#endif
diff --git a/rsvg-private.h b/rsvg-private.h
index a39e5e5..0f10197 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -284,7 +284,8 @@ typedef struct {
} RsvgBbox;
typedef enum {
- objectBoundingBox, userSpaceOnUse
+ objectBoundingBox,
+ userSpaceOnUse
} RsvgCoordUnits;
/* Keep this in sync with rust/src/node.rs:NodeType */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]