Commit 33db5b49 authored by Dom Lachowicz's avatar Dom Lachowicz

some work toward conditionals, visibility being handled properly

parent e67b70cc
......@@ -344,12 +344,6 @@ rsvg_render_bpath (RsvgDrawingCtx *ctx, const ArtBpath *bpath)
state = rsvg_state_current (ctx);
/* todo: handle visibility stuff earlier for performance benefits
* handles all path based shapes. will handle text and images separately
*/
if (!state->visible || !state->cond_true)
return;
affine_bpath = art_bpath_affine_transform (bpath,
state->affine);
......
......@@ -60,7 +60,7 @@ static const char * implemented_features [] =
static const guint nb_implemented_features = G_N_ELEMENTS(implemented_features);
static const char ** implemented_extensions = NULL;
static const guint nb_implemented_extensions = G_N_ELEMENTS(implemented_extensions);
static const guint nb_implemented_extensions = 0;
static int
rsvg_feature_compare(const void *a, const void *b)
......
......@@ -154,7 +154,7 @@ rsvg_start_marker (RsvgHandle *ctx, RsvgPropertyBag *atts)
/* set up the defval stuff */
marker->super.type = RSVG_DEF_MARKER;
marker->contents = (RsvgDefsDrawable *)rsvg_push_part_def_group(ctx, NULL, state);
marker->contents = (RsvgDefsDrawable *)rsvg_push_part_def_group(ctx, NULL, &state);
rsvg_state_init (&marker->contents->state);
marker->super.free = rsvg_marker_free;
......
......@@ -892,6 +892,6 @@ rsvg_start_pattern (RsvgHandle *ctx, RsvgPropertyBag *atts)
pattern->vbh = (cloned && !got_vbox) ? pattern->vbh : vbh;
pattern->vbox = (cloned && !got_vbox) ? pattern->vbox : got_vbox;
pattern->g = &(rsvg_push_part_def_group (ctx, NULL, state)->super);
pattern->g = &(rsvg_push_part_def_group (ctx, NULL, &state)->super);
}
......@@ -88,7 +88,6 @@ struct RsvgHandle {
file is converted into at the end */
void *treebase;
guint in_switch;
GHashTable *css_props;
/* not a handler stack. each nested handler keeps
......@@ -117,6 +116,8 @@ struct RsvgHandle {
gboolean finished;
int in_switch;
void * currentfilter;
void * currentsubfilter;
......
......@@ -36,6 +36,13 @@ void
rsvg_defs_drawable_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
int dominate)
{
RsvgState *state;
state = &self->state;
if (0 /*!state->visible*/)
return;
self->draw(self, ctx, dominate);
}
......@@ -56,7 +63,7 @@ rsvg_start_g (RsvgHandle *ctx, RsvgPropertyBag *atts)
rsvg_parse_style_attrs (ctx, &state, "g", klazz, id, atts);
}
rsvg_push_def_group (ctx, id, state);
rsvg_push_def_group (ctx, id, &state);
}
void
......@@ -74,18 +81,13 @@ rsvg_defs_drawable_group_draw (RsvgDefsDrawable * self, RsvgDrawingCtx *ctx,
rsvg_state_reinherit_top(ctx, &self->state, dominate);
if (!self->state.visible || !self->state.cond_true)
return;
rsvg_push_discrete_layer (ctx);
rsvg_push_discrete_layer (ctx);
for (i = 0; i < group->children->len; i++)
{
rsvg_state_push(ctx);
rsvg_defs_drawable_draw (g_ptr_array_index(group->children, i),
ctx, 0);
rsvg_state_pop(ctx);
}
......@@ -103,7 +105,7 @@ rsvg_defs_drawable_group_free (RsvgDefVal *self)
RsvgDefsDrawable *
rsvg_push_def_group (RsvgHandle *ctx, const char * id,
RsvgState state)
RsvgState *state)
{
RsvgDefsDrawable * group;
......@@ -128,7 +130,6 @@ rsvg_pop_def_group (RsvgHandle *ctx)
}
void
rsvg_defs_drawable_group_pack (RsvgDefsDrawableGroup *self, RsvgDefsDrawable *child)
{
......@@ -137,15 +138,16 @@ rsvg_defs_drawable_group_pack (RsvgDefsDrawableGroup *self, RsvgDefsDrawable *ch
g_ptr_array_add(self->children, child);
}
/* warning: takes ownership of @tempstate */
RsvgDefsDrawable *
rsvg_push_part_def_group (RsvgHandle *ctx, const char * id,
RsvgState tempstate)
RsvgState * tempstate)
{
RsvgDefsDrawableGroup *group;
group = g_new (RsvgDefsDrawableGroup, 1);
group->children = g_ptr_array_new();
group->super.state = tempstate;
group->super.state = *tempstate;
group->super.super.type = RSVG_DEF_PATH;
group->super.super.free = rsvg_defs_drawable_group_free;
......@@ -582,5 +584,5 @@ rsvg_start_defs (RsvgHandle *ctx, RsvgPropertyBag *atts)
/*I don't know if I am proud or discusted by this hack. It seems to
have the same effect as the spec but not be in its spirit.*/
rsvg_push_part_def_group (ctx, id, state);
rsvg_push_part_def_group (ctx, id, &state);
}
......@@ -86,9 +86,9 @@ struct _RsvgDefsDrawableSvg {
};
RsvgDefsDrawable * rsvg_push_def_group (RsvgHandle *ctx, const char * id,
RsvgState);
RsvgState *);
RsvgDefsDrawable * rsvg_push_part_def_group (RsvgHandle *ctx, const char * id,
RsvgState);
RsvgState *);
void rsvg_pop_def_group (RsvgHandle *ctx);
void rsvg_defs_drawable_group_pack (RsvgDefsDrawableGroup *self,
RsvgDefsDrawable *child);
......
......@@ -524,8 +524,10 @@ rsvg_start_element (void *data, const xmlChar *name,
rsvg_start_clip_path(ctx, bag);
else if (!strcmp ((char *)name, "marker"))
rsvg_start_marker (ctx, bag);
else if (!strcmp ((char *)name, "switch"))
else if (!strcmp ((char *)name, "switch")) {
ctx->in_switch++;
rsvg_start_g (ctx, bag); /* treat switches as groups for now */
}
/* see conicalGradient discussion above */
else if (!strcmp ((char *)name, "linearGradient"))
rsvg_start_linear_gradient (ctx, bag);
......@@ -586,10 +588,10 @@ rsvg_end_element (void *data, const xmlChar *name)
rsvg_end_clip_path(ctx);
else if (!strcmp ((char *)name, "marker"))
rsvg_pop_def_group(ctx);
else if (!strcmp ((char *)name, "switch"))
{
ctx->in_switch--;
}
else if (!strcmp ((char *)name, "switch")) {
rsvg_end_g (ctx); /* treat switches as groups for now */
ctx->in_switch--;
}
else if (!strcmp ((char *)name, "pattern"))
rsvg_pop_def_group(ctx);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment