Commit 611729cb authored by Caleb Michael Moore's avatar Caleb Michael Moore

more filter fixes

parent dd832ae3
...@@ -1203,6 +1203,7 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx, ...@@ -1203,6 +1203,7 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx,
int i, j, listlen; int i, j, listlen;
double font_size; double font_size;
const char *value; const char *value;
gboolean has_target_x, has_target_y;
RsvgFilterPrimitiveConvolveMatrix *filter; RsvgFilterPrimitiveConvolveMatrix *filter;
font_size = rsvg_state_current_font_size (ctx); font_size = rsvg_state_current_font_size (ctx);
...@@ -1215,8 +1216,8 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx, ...@@ -1215,8 +1216,8 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx,
filter->divisor = 0; filter->divisor = 0;
filter->bias = 0; filter->bias = 0;
filter->targetx = 0; has_target_x = 0;
filter->targety = 0; has_target_y = 0;
filter->dx = 0; filter->dx = 0;
filter->dy = 0; filter->dy = 0;
filter->preservealpha = FALSE; filter->preservealpha = FALSE;
...@@ -1265,9 +1266,15 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx, ...@@ -1265,9 +1266,15 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx,
filter->super.sizedefaults = 0; filter->super.sizedefaults = 0;
} }
if ((value = rsvg_property_bag_lookup (atts, "targetX"))) if ((value = rsvg_property_bag_lookup (atts, "targetX")))
filter->targetx = atoi (value); {
has_target_x = 1;
filter->targetx = atoi (value);
}
if ((value = rsvg_property_bag_lookup (atts, "targetY"))) if ((value = rsvg_property_bag_lookup (atts, "targetY")))
filter->targety = atoi (value); {
has_target_y = 1;
filter->targety = atoi (value);
}
if ((value = rsvg_property_bag_lookup (atts, "bias"))) if ((value = rsvg_property_bag_lookup (atts, "bias")))
filter->bias = atof (value); filter->bias = atof (value);
if ((value = rsvg_property_bag_lookup (atts, "preserveAlpha"))) if ((value = rsvg_property_bag_lookup (atts, "preserveAlpha")))
...@@ -1303,7 +1310,7 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx, ...@@ -1303,7 +1310,7 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx,
else if (!strcmp (value, "none")) else if (!strcmp (value, "none"))
filter->edgemode = 2; filter->edgemode = 2;
else else
filter->edgemode = 0; filter->edgemode = 0;
} }
} }
...@@ -1320,6 +1327,15 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx, ...@@ -1320,6 +1327,15 @@ rsvg_start_filter_primitive_convolve_matrix (RsvgHandle * ctx,
if (listlen < filter->orderx * filter->ordery) if (listlen < filter->orderx * filter->ordery)
filter->orderx = filter->ordery = 0; filter->orderx = filter->ordery = 0;
if (!has_target_x)
{
filter->targetx = floor(filter->orderx / 2);
}
if (!has_target_y)
{
filter->targety = floor(filter->ordery / 2);
}
filter->super.render = &rsvg_filter_primitive_convolve_matrix_render; filter->super.render = &rsvg_filter_primitive_convolve_matrix_render;
filter->super.free = &rsvg_filter_primitive_convolve_matrix_free; filter->super.free = &rsvg_filter_primitive_convolve_matrix_free;
......
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