[librsvg] Use cairo_fill_rule_t directly
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Use cairo_fill_rule_t directly
- Date: Mon, 7 Nov 2011 19:26:37 +0000 (UTC)
commit acce1f68e0b5c4b94f066516be48a4cd867bfcb4
Author: Christian Persch <chpe gnome org>
Date: Thu Sep 15 15:32:16 2011 +0200
Use cairo_fill_rule_t directly
rsvg-cairo-clip.c | 5 +----
rsvg-cairo-draw.c | 6 ++----
rsvg-styles.c | 12 ++++++------
rsvg-styles.h | 5 -----
4 files changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/rsvg-cairo-clip.c b/rsvg-cairo-clip.c
index 258cb88..3aeb7d8 100644
--- a/rsvg-cairo-clip.c
+++ b/rsvg-cairo-clip.c
@@ -75,10 +75,7 @@ rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_de
rsvg_cairo_clip_apply_affine (render, state->affine);
- if (rsvg_current_state (ctx)->clip_rule == FILL_RULE_EVENODD)
- cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
- else /* state->fill_rule == FILL_RULE_NONZERO */
- cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
+ cairo_set_fill_rule (cr, rsvg_current_state (ctx)->clip_rule);
for (i = 0; i < bpath_def->n_bpath; i++) {
bpath = &bpath_def->bpath[i];
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index 05158c1..c8ec347 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -558,10 +558,8 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
if (state->fill != NULL) {
int opacity;
- if (state->fill_rule == FILL_RULE_EVENODD)
- cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
- else /* state->fill_rule == FILL_RULE_NONZERO */
- cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
+
+ cairo_set_fill_rule (cr, state->fill_rule);
if (!need_tmpbuf)
opacity = (state->fill_opacity * state->opacity) / 255;
diff --git a/rsvg-styles.c b/rsvg-styles.c
index 0c03da1..44bc5c5 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -94,8 +94,8 @@ rsvg_state_init (RsvgState * state)
state->cap = RSVG_PATH_STROKE_CAP_BUTT;
state->join = RSVG_PATH_STROKE_JOIN_MITER;
state->stop_opacity = 0xff;
- state->fill_rule = FILL_RULE_NONZERO;
- state->clip_rule = FILL_RULE_NONZERO;
+ state->fill_rule = CAIRO_FILL_RULE_WINDING;
+ state->clip_rule = CAIRO_FILL_RULE_WINDING;
state->enable_background = RSVG_ENABLE_BACKGROUND_ACCUMULATE;
state->comp_op = CAIRO_OPERATOR_OVER;
state->overflow = FALSE;
@@ -576,17 +576,17 @@ rsvg_parse_style_pair (RsvgHandle * ctx,
} else if (g_str_equal (name, "fill-rule")) {
state->has_fill_rule = TRUE;
if (g_str_equal (value, "nonzero"))
- state->fill_rule = FILL_RULE_NONZERO;
+ state->fill_rule = CAIRO_FILL_RULE_WINDING;
else if (g_str_equal (value, "evenodd"))
- state->fill_rule = FILL_RULE_EVENODD;
+ state->fill_rule = CAIRO_FILL_RULE_EVEN_ODD;
else
state->has_fill_rule = FALSE;
} else if (g_str_equal (name, "clip-rule")) {
state->has_clip_rule = TRUE;
if (g_str_equal (value, "nonzero"))
- state->clip_rule = FILL_RULE_NONZERO;
+ state->clip_rule = CAIRO_FILL_RULE_WINDING;
else if (g_str_equal (value, "evenodd"))
- state->clip_rule = FILL_RULE_EVENODD;
+ state->clip_rule = CAIRO_FILL_RULE_EVEN_ODD;
else
state->has_clip_rule = FALSE;
} else if (g_str_equal (name, "stroke")) {
diff --git a/rsvg-styles.h b/rsvg-styles.h
index 419c877..4e7c694 100644
--- a/rsvg-styles.h
+++ b/rsvg-styles.h
@@ -51,11 +51,6 @@ typedef enum {
TEXT_ANCHOR_END
} TextAnchor;
-enum {
- FILL_RULE_EVENODD = 0,
- FILL_RULE_NONZERO = 1
-};
-
typedef enum {
UNICODE_BIDI_NORMAL = 0,
UNICODE_BIDI_EMBED = 1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]