[librsvg] _rsvg_css_hand_normalize_length_sub is unnecessary.



commit 067437540fd55f2899a2b13c81a6cad509dd727d
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date:   Mon Apr 5 19:31:05 2010 +0900

    _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.

 rsvg-base.c    |   24 ++++++------------------
 rsvg-css.c     |   19 -------------------
 rsvg-private.h |    3 ---
 3 files changed, 6 insertions(+), 40 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 8b96bd6..bcb28d1 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -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;
diff --git a/rsvg-css.c b/rsvg-css.c
index e988ce5..777f962 100644
--- a/rsvg-css.c
+++ b/rsvg-css.c
@@ -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)
 {
diff --git a/rsvg-private.h b/rsvg-private.h
index 93fd046..e8d47c3 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]