Commit 06743754 authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe

_rsvg_css_hand_normalize_length_sub is unnecessary.

In case of sub element, the element dimensions have already been
calculated in rsvg_node_draw in user coordinate system, so each
value can be used as it is.
parent a00a156f
......@@ -1388,11 +1388,8 @@ rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimensi
cairo_destroy (cr);
cairo_surface_destroy (target);
dimension_data->width = (int) (_rsvg_css_hand_normalize_length_sub (&root->w, bbox.w, handle->priv->dpi_x,
bbox.w + bbox.x * 2, 12) + 0.5);
dimension_data->height = (int) (_rsvg_css_hand_normalize_length_sub (&root->h, bbox.h, handle->priv->dpi_y,
bbox.h + bbox.y * 2,
12) + 0.5);
dimension_data->width = bbox.w;
dimension_data->height = bbox.h;
} else {
bbox.w = root->vbox.w;
bbox.h = root->vbox.h;
......@@ -1490,19 +1487,10 @@ rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_d
rsvg_state_pop (draw);
rsvg_drawing_ctx_free (draw);
/* Calculate position.
* TODO: figure out what "bbox.w + bbox.x * 2" is or means
* (copied from rsvg_handle_get_dimensions_sub(). - robsta */
position_data->x = (int) (_rsvg_css_hand_normalize_length_sub (&root->x, bbox.x, handle->priv->dpi_x,
bbox.w + bbox.x * 2, 12) + 0.5);
position_data->y = (int) (_rsvg_css_hand_normalize_length_sub (&root->y, bbox.y, handle->priv->dpi_y,
bbox.h + bbox.y * 2, 12) + 0.5);
/* Also calculate dimension for the size callback, while re're at it. */
dimension_data.width = (int) (_rsvg_css_hand_normalize_length_sub (&root->w, bbox.w, handle->priv->dpi_x,
bbox.w + bbox.x * 2, 12) + 0.5);
dimension_data.height = (int) (_rsvg_css_hand_normalize_length_sub (&root->h, bbox.h, handle->priv->dpi_y,
bbox.h + bbox.y * 2, 12) + 0.5);
position_data->x = bbox.x;
position_data->y = bbox.y;
dimension_data.width = bbox.w;
dimension_data.height = bbox.h;
dimension_data.em = dimension_data.width;
dimension_data.ex = dimension_data.height;
......
......@@ -252,25 +252,6 @@ _rsvg_css_hand_normalize_length (const RsvgLength * in, gdouble pixels_per_inch,
return 0;
}
double
_rsvg_css_hand_normalize_length_sub (const RsvgLength * in, gdouble length,
gdouble pixels_per_inch, gdouble width_or_height,
gdouble font_size)
{
if (in->factor == '\0')
return length;
else if (in->factor == 'p')
return length * width_or_height;
else if (in->factor == 'm')
return length * font_size;
else if (in->factor == 'x')
return length * font_size / 2.;
else if (in->factor == 'i')
return length * pixels_per_inch;
return 0;
}
gboolean
rsvg_css_param_match (const char *str, const char *param_name)
{
......
......@@ -346,9 +346,6 @@ void rsvg_bbox_clip (RsvgBbox * dst, RsvgBbox * src);
double _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx, char dir);
double _rsvg_css_hand_normalize_length (const RsvgLength * in, gdouble pixels_per_inch,
gdouble width_or_height, gdouble font_size);
double _rsvg_css_hand_normalize_length_sub (const RsvgLength * in, gdouble length,
gdouble pixels_per_inch, gdouble width_or_height,
gdouble font_size);
RsvgLength _rsvg_css_parse_length (const char *str);
......
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