[librsvg] Use cairo_rectangle_t



commit 396efea7fa5518c49c0ceba78867acaaeaa0da06
Author: Christian Persch <chpe gnome org>
Date:   Thu Sep 15 23:39:01 2011 +0200

    Use cairo_rectangle_t

 rsvg-base.c         |   76 +++++++++++++++++++++++++-------------------------
 rsvg-cairo-clip.c   |    8 +++---
 rsvg-cairo-draw.c   |   73 ++++++++++++++++++++++++++-----------------------
 rsvg-cairo-render.c |    4 +-
 rsvg-css.c          |   19 +++++++------
 rsvg-filter.c       |   46 +++++++++++++++---------------
 rsvg-marker.c       |   17 +++++++-----
 rsvg-private.h      |    6 +++-
 rsvg-structure.c    |   27 ++++++++++--------
 9 files changed, 145 insertions(+), 131 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 414fd79..454f20a 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -1387,8 +1387,8 @@ rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimensi
     if (!root)
         return FALSE;
 
-    bbox.x = bbox.y = 0;
-    bbox.w = bbox.h = 1;
+    bbox.rect.x = bbox.rect.y = 0;
+    bbox.rect.width = bbox.rect.height = 1;
 
     if (!id && (root->w.factor == 'p' || root->h.factor == 'p')
             && !root->vbox.active)
@@ -1427,16 +1427,16 @@ rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimensi
         cairo_destroy (cr);
         cairo_surface_destroy (target);
 
-        dimension_data->width = bbox.w;
-        dimension_data->height = bbox.h;
+        dimension_data->width = bbox.rect.width;
+        dimension_data->height = bbox.rect.height;
     } else {
-        bbox.w = root->vbox.w;
-        bbox.h = root->vbox.h;
+        bbox.rect.width = root->vbox.rect.width;
+        bbox.rect.height = root->vbox.rect.height;
 
         dimension_data->width = (int) (_rsvg_css_hand_normalize_length (&root->w, handle->priv->dpi_x,
-                                       bbox.w + bbox.x * 2, 12) + 0.5);
+                                       bbox.rect.width + bbox.rect.x * 2, 12) + 0.5);
         dimension_data->height = (int) (_rsvg_css_hand_normalize_length (&root->h, handle->priv->dpi_y,
-                                         bbox.h + bbox.y * 2,
+                                         bbox.rect.height + bbox.rect.y * 2,
                                          12) + 0.5);
     }
     
@@ -1523,10 +1523,10 @@ rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_d
     rsvg_state_pop (draw);
     rsvg_drawing_ctx_free (draw);
 
-    position_data->x = bbox.x;
-    position_data->y = bbox.y;
-    dimension_data.width = bbox.w;
-    dimension_data.height = bbox.h;
+    position_data->x = bbox.rect.x;
+    position_data->y = bbox.rect.y;
+    dimension_data.width = bbox.rect.width;
+    dimension_data.height = bbox.rect.height;
 
     dimension_data.em = dimension_data.width;
     dimension_data.ex = dimension_data.height;
@@ -2119,8 +2119,8 @@ rsvg_bbox_insert (RsvgBbox * dst, RsvgBbox * src)
         return;
 
     if (!dst->virgin) {
-        xmin = dst->x, ymin = dst->y;
-        xmax = dst->x + dst->w, ymax = dst->y + dst->h;
+        xmin = dst->rect.x, ymin = dst->rect.y;
+        xmax = dst->rect.x + dst->rect.width, ymax = dst->rect.y + dst->rect.height;
     } else {
         xmin = ymin = xmax = ymax = 0;
     }
@@ -2130,8 +2130,8 @@ rsvg_bbox_insert (RsvgBbox * dst, RsvgBbox * src)
 
     for (i = 0; i < 4; i++) {
         double rx, ry, x, y;
-        rx = src->x + src->w * (double) (i % 2);
-        ry = src->y + src->h * (double) (i / 2);
+        rx = src->rect.x + src->rect.width * (double) (i % 2);
+        ry = src->rect.y + src->rect.height * (double) (i / 2);
         x = affine[0] * rx + affine[2] * ry + affine[4];
         y = affine[1] * rx + affine[3] * ry + affine[5];
         if (dst->virgin) {
@@ -2149,10 +2149,10 @@ rsvg_bbox_insert (RsvgBbox * dst, RsvgBbox * src)
                 ymax = y;
         }
     }
-    dst->x = xmin;
-    dst->y = ymin;
-    dst->w = xmax - xmin;
-    dst->h = ymax - ymin;
+    dst->rect.x = xmin;
+    dst->rect.y = ymin;
+    dst->rect.width = xmax - xmin;
+    dst->rect.height = ymax - ymin;
 }
 
 void
@@ -2167,8 +2167,8 @@ rsvg_bbox_clip (RsvgBbox * dst, RsvgBbox * src)
         return;
 
 	if (!dst->virgin) {
-        xmin = dst->x + dst->w, ymin = dst->y + dst->h;
-        xmax = dst->x, ymax = dst->y;
+        xmin = dst->rect.x + dst->rect.width, ymin = dst->rect.y + dst->rect.height;
+        xmax = dst->rect.x, ymax = dst->rect.y;
     } else {
         xmin = ymin = xmax = ymax = 0;
     }
@@ -2178,8 +2178,8 @@ rsvg_bbox_clip (RsvgBbox * dst, RsvgBbox * src)
 
     for (i = 0; i < 4; i++) {
         double rx, ry, x, y;
-        rx = src->x + src->w * (double) (i % 2);
-        ry = src->y + src->h * (double) (i / 2);
+        rx = src->rect.x + src->rect.width * (double) (i % 2);
+        ry = src->rect.y + src->rect.height * (double) (i / 2);
         x = affine[0] * rx + affine[2] * ry + affine[4];
         y = affine[1] * rx + affine[3] * ry + affine[5];
         if (dst->virgin) {
@@ -2198,19 +2198,19 @@ rsvg_bbox_clip (RsvgBbox * dst, RsvgBbox * src)
         }
     }
 
-    if (xmin < dst->x)
-        xmin = dst->x;
-    if (ymin < dst->y)
-        ymin = dst->y;
-    if (xmax > dst->x + dst->w)
-        xmax = dst->x + dst->w;
-    if (ymax > dst->y + dst->h)
-        ymax = dst->y + dst->h;
+    if (xmin < dst->rect.x)
+        xmin = dst->rect.x;
+    if (ymin < dst->rect.y)
+        ymin = dst->rect.y;
+    if (xmax > dst->rect.x + dst->rect.width)
+        xmax = dst->rect.x + dst->rect.width;
+    if (ymax > dst->rect.y + dst->rect.height)
+        ymax = dst->rect.y + dst->rect.height;
 
-    dst->x = xmin;
-    dst->w = xmax - xmin;
-    dst->y = ymin;
-    dst->h = ymax - ymin;
+    dst->rect.x = xmin;
+    dst->rect.width = xmax - xmin;
+    dst->rect.y = ymin;
+    dst->rect.height = ymax - ymin;
 }
 
 void
@@ -2219,8 +2219,8 @@ _rsvg_push_view_box (RsvgDrawingCtx * ctx, double w, double h)
     RsvgViewBox *vb = g_new (RsvgViewBox, 1);
     *vb = ctx->vb;
     ctx->vb_stack = g_slist_prepend (ctx->vb_stack, vb);
-    ctx->vb.w = w;
-    ctx->vb.h = h;
+    ctx->vb.rect.width = w;
+    ctx->vb.rect.height = h;
 }
 
 void
diff --git a/rsvg-cairo-clip.c b/rsvg-cairo-clip.c
index 622c989..ca87628 100644
--- a/rsvg-cairo-clip.c
+++ b/rsvg-cairo-clip.c
@@ -165,12 +165,12 @@ rsvg_cairo_clip (RsvgDrawingCtx * ctx, RsvgClipPath * clip, RsvgBbox * bbox)
     /* Horribly dirty hack to have the bbox premultiplied to everything */
     if (clip->units == objectBoundingBox) {
         double bbtransform[6];
-        bbtransform[0] = bbox->w;
+        bbtransform[0] = bbox->rect.width;
         bbtransform[1] = 0.;
         bbtransform[2] = 0.;
-        bbtransform[3] = bbox->h;
-        bbtransform[4] = bbox->x;
-        bbtransform[5] = bbox->y;
+        bbtransform[3] = bbox->rect.height;
+        bbtransform[4] = bbox->rect.x;
+        bbtransform[5] = bbox->rect.y;
         for (i = 0; i < 6; i++)
             affinesave[i] = clip->super.state->affine[i];
         _rsvg_affine_multiply (clip->super.state->affine, bbtransform, clip->super.state->affine);
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index 197ac87..561010c 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -105,7 +105,8 @@ _set_source_rsvg_linear_gradient (RsvgDrawingCtx * ctx,
                        linear->affine[2], linear->affine[3], linear->affine[4], linear->affine[5]);
     if (linear->obj_bbox) {
         cairo_matrix_t bboxmatrix;
-        cairo_matrix_init (&bboxmatrix, bbox.w, 0, 0, bbox.h, bbox.x, bbox.y);
+        cairo_matrix_init (&bboxmatrix, bbox.rect.width, 0, 0, bbox.rect.height,
+                           bbox.rect.x, bbox.rect.y);
         cairo_matrix_multiply (&matrix, &matrix, &bboxmatrix);
     }
     cairo_matrix_invert (&matrix);
@@ -151,7 +152,8 @@ _set_source_rsvg_radial_gradient (RsvgDrawingCtx * ctx,
                        radial->affine[2], radial->affine[3], radial->affine[4], radial->affine[5]);
     if (radial->obj_bbox) {
         cairo_matrix_t bboxmatrix;
-        cairo_matrix_init (&bboxmatrix, bbox.w, 0, 0, bbox.h, bbox.x, bbox.y);
+        cairo_matrix_init (&bboxmatrix, bbox.rect.width, 0, 0, bbox.rect.height,
+                           bbox.rect.x, bbox.rect.y);
         cairo_matrix_multiply (&matrix, &matrix, &bboxmatrix);
     }
 
@@ -224,8 +226,8 @@ _set_source_rsvg_pattern (RsvgDrawingCtx * ctx,
 
 
     if (rsvg_pattern->obj_bbox) {
-        bbwscale = bbox.w;
-        bbhscale = bbox.h;
+        bbwscale = bbox.rect.width;
+        bbhscale = bbox.rect.height;
     } else {
         bbwscale = 1.0;
         bbhscale = 1.0;
@@ -249,8 +251,8 @@ _set_source_rsvg_pattern (RsvgDrawingCtx * ctx,
     /* Create the pattern coordinate system */
     if (rsvg_pattern->obj_bbox) {
         /* subtract the pattern origin */
-        affine[4] = bbox.x + patternx * bbox.w;
-        affine[5] = bbox.y + patterny * bbox.h;
+        affine[4] = bbox.rect.x + patternx * bbox.rect.width;
+        affine[5] = bbox.rect.y + patterny * bbox.rect.height;
     } else {
         /* subtract the pattern origin */
         affine[4] = patternx;
@@ -268,20 +270,21 @@ _set_source_rsvg_pattern (RsvgDrawingCtx * ctx,
         x = 0;
         y = 0;
         rsvg_preserve_aspect_ratio (rsvg_pattern->preserve_aspect_ratio,
-                                    rsvg_pattern->vbox.w, rsvg_pattern->vbox.h, &w, &h, &x, &y);
+                                    rsvg_pattern->vbox.rect.width, rsvg_pattern->vbox.rect.height,
+                                    &w, &h, &x, &y);
 
-        x -= rsvg_pattern->vbox.x * w / rsvg_pattern->vbox.w;
-        y -= rsvg_pattern->vbox.y * h / rsvg_pattern->vbox.h;
+        x -= rsvg_pattern->vbox.rect.x * w / rsvg_pattern->vbox.rect.width;
+        y -= rsvg_pattern->vbox.rect.y * h / rsvg_pattern->vbox.rect.height;
 
-        caffine[0] = w / rsvg_pattern->vbox.w;
-        caffine[3] = h / rsvg_pattern->vbox.h;
+        caffine[0] = w / rsvg_pattern->vbox.rect.width;
+        caffine[3] = h / rsvg_pattern->vbox.rect.height;
         caffine[4] = x;
         caffine[5] = y;
-        _rsvg_push_view_box (ctx, rsvg_pattern->vbox.w, rsvg_pattern->vbox.h);
+        _rsvg_push_view_box (ctx, rsvg_pattern->vbox.rect.width, rsvg_pattern->vbox.rect.height);
     } else if (rsvg_pattern->obj_cbbox) {
         /* If coords are in terms of the bounding box, use them */
-        caffine[0] = bbox.w;
-        caffine[3] = bbox.h;
+        caffine[0] = bbox.rect.width;
+        caffine[3] = bbox.rect.height;
         _rsvg_push_view_box (ctx, 1., 1.);
     }
 
@@ -396,10 +399,10 @@ rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, doub
     pango_layout_get_extents (layout, &ink, NULL);
 
     rsvg_bbox_init (&bbox, state->affine);
-    bbox.x = x + ink.x / (double)PANGO_SCALE;
-    bbox.y = y + ink.y / (double)PANGO_SCALE;
-    bbox.w = ink.width / (double)PANGO_SCALE;
-    bbox.h = ink.height / (double)PANGO_SCALE;
+    bbox.rect.x = x + ink.x / (double)PANGO_SCALE;
+    bbox.rect.y = y + ink.y / (double)PANGO_SCALE;
+    bbox.rect.width = ink.width / (double)PANGO_SCALE;
+    bbox.rect.height = ink.height / (double)PANGO_SCALE;
     bbox.virgin = 0;
 
     if (state->fill) {
@@ -500,18 +503,18 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
     if (state->fill != NULL) {
         RsvgBbox fb;
         rsvg_bbox_init (&fb, state->affine);
-        cairo_fill_extents (cr, &fb.x, &fb.y, &fb.w, &fb.h);
-        fb.w -= fb.x;
-        fb.h -= fb.y;
+        cairo_fill_extents (cr, &fb.rect.x, &fb.rect.y, &fb.rect.width, &fb.rect.height);
+        fb.rect.width -= fb.rect.x;
+        fb.rect.height -= fb.rect.y;
         fb.virgin = 0;
         rsvg_bbox_insert (&bbox, &fb);
     }
     if (state->stroke != NULL) {
         RsvgBbox sb;
         rsvg_bbox_init (&sb, state->affine);
-        cairo_stroke_extents (cr, &sb.x, &sb.y, &sb.w, &sb.h);
-        sb.w -= sb.x;
-        sb.h -= sb.y;
+        cairo_stroke_extents (cr, &sb.rect.x, &sb.rect.y, &sb.rect.width, &sb.rect.height);
+        sb.rect.width -= sb.rect.x;
+        sb.rect.height -= sb.rect.y;
         sb.virgin = 0;
         rsvg_bbox_insert (&bbox, &sb);
     }
@@ -587,10 +590,10 @@ rsvg_cairo_render_image (RsvgDrawingCtx * ctx, const GdkPixbuf * pixbuf,
         return;
 
     rsvg_bbox_init (&bbox, state->affine);
-    bbox.x = pixbuf_x;
-    bbox.y = pixbuf_y;
-    bbox.w = w;
-    bbox.h = h;
+    bbox.rect.x = pixbuf_x;
+    bbox.rect.y = pixbuf_y;
+    bbox.rect.width = w;
+    bbox.rect.height = h;
     bbox.virgin = 0;
 
     _set_rsvg_affine (render, state->affine);
@@ -722,20 +725,22 @@ rsvg_cairo_generate_mask (cairo_t * cr, RsvgMask * self, RsvgDrawingCtx * ctx, R
 
     if (self->maskunits == objectBoundingBox)
         rsvg_cairo_add_clipping_rect (ctx,
-                                      sx * bbox->w + bbox->x,
-                                      sy * bbox->h + bbox->y, sw * bbox->w, sh * bbox->h);
+                                      sx * bbox->rect.width + bbox->rect.x,
+                                      sy * bbox->rect.height + bbox->rect.y,
+                                      sw * bbox->rect.width,
+                                      sh * bbox->rect.height);
     else
         rsvg_cairo_add_clipping_rect (ctx, sx, sy, sw, sh);
 
     /* Horribly dirty hack to have the bbox premultiplied to everything */
     if (self->contentunits == objectBoundingBox) {
         double bbtransform[6];
-        bbtransform[0] = bbox->w;
+        bbtransform[0] = bbox->rect.width;
         bbtransform[1] = 0.;
         bbtransform[2] = 0.;
-        bbtransform[3] = bbox->h;
-        bbtransform[4] = bbox->x;
-        bbtransform[5] = bbox->y;
+        bbtransform[3] = bbox->rect.height;
+        bbtransform[4] = bbox->rect.x;
+        bbtransform[5] = bbox->rect.y;
         for (i = 0; i < 6; i++)
             affinesave[i] = self->super.state->affine[i];
         _rsvg_affine_multiply (self->super.state->affine, bbtransform, self->super.state->affine);
diff --git a/rsvg-cairo-render.c b/rsvg-cairo-render.c
index 83ed99e..f4eac23 100644
--- a/rsvg-cairo-render.c
+++ b/rsvg-cairo-render.c
@@ -149,8 +149,8 @@ rsvg_cairo_new_drawing_ctx (cairo_t * cr, RsvgHandle * handle)
     draw->base_uri = g_strdup (handle->priv->base_uri);
     draw->dpi_x = handle->priv->dpi_x;
     draw->dpi_y = handle->priv->dpi_y;
-    draw->vb.w = data.em;
-    draw->vb.h = data.ex;
+    draw->vb.rect.width = data.em;
+    draw->vb.rect.height = data.ex;
     draw->pango_context = NULL;
     draw->drawsub_stack = NULL;
     draw->ptrs = NULL;
diff --git a/rsvg-css.c b/rsvg-css.c
index be9b7fa..bbba7c0 100644
--- a/rsvg-css.c
+++ b/rsvg-css.c
@@ -65,8 +65,8 @@ rsvg_css_parse_vbox (const char *vbox)
     guint list_len;
     vb.active = FALSE;
 
-    vb.x = vb.y = 0;
-    vb.w = vb.h = 0;
+    vb.rect.x = vb.rect.y = 0;
+    vb.rect.width = vb.rect.height = 0;
 
     list = rsvg_css_parse_number_list (vbox, &list_len);
 
@@ -76,10 +76,10 @@ rsvg_css_parse_vbox (const char *vbox)
         g_free (list);
         return vb;
     } else {
-        vb.x = list[0];
-        vb.y = list[1];
-        vb.w = list[2];
-        vb.h = list[3];
+        vb.rect.x = list[0];
+        vb.rect.y = list[1];
+        vb.rect.width = list[2];
+        vb.rect.height = list[3];
         vb.active = TRUE;
 
         g_free (list);
@@ -231,11 +231,12 @@ _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx, char di
         return in->length;
     else if (in->factor == 'p') {
         if (dir == 'h')
-            return in->length * ctx->vb.w;
+            return in->length * ctx->vb.rect.width;
         if (dir == 'v')
-            return in->length * ctx->vb.h;
+            return in->length * ctx->vb.rect.height;
         if (dir == 'o')
-            return in->length * rsvg_viewport_percentage (ctx->vb.w, ctx->vb.h);
+            return in->length * rsvg_viewport_percentage (ctx->vb.rect.width,
+                                                          ctx->vb.rect.height);
     } else if (in->factor == 'm' || in->factor == 'x') {
         double font = _rsvg_css_normalize_font_size (rsvg_current_state (ctx), ctx);
         if (in->factor == 'm')
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 256c876..a918f9f 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -97,10 +97,10 @@ rsvg_filter_primitive_get_bounds (RsvgFilterPrimitive * self, RsvgFilterContext
     otherbox.virgin = 0;
     if (ctx->filter->filterunits == objectBoundingBox)
         _rsvg_push_view_box (ctx->ctx, 1., 1.);
-    otherbox.x = _rsvg_css_normalize_length (&ctx->filter->x, ctx->ctx, 'h');
-    otherbox.y = _rsvg_css_normalize_length (&ctx->filter->y, ctx->ctx, 'v');
-    otherbox.w = _rsvg_css_normalize_length (&ctx->filter->width, ctx->ctx, 'h');
-    otherbox.h = _rsvg_css_normalize_length (&ctx->filter->height, ctx->ctx, 'v');
+    otherbox.rect.x = _rsvg_css_normalize_length (&ctx->filter->x, ctx->ctx, 'h');
+    otherbox.rect.y = _rsvg_css_normalize_length (&ctx->filter->y, ctx->ctx, 'v');
+    otherbox.rect.width = _rsvg_css_normalize_length (&ctx->filter->width, ctx->ctx, 'h');
+    otherbox.rect.height = _rsvg_css_normalize_length (&ctx->filter->height, ctx->ctx, 'v');
     if (ctx->filter->filterunits == objectBoundingBox)
         _rsvg_pop_view_box (ctx->ctx);
 
@@ -115,21 +115,21 @@ rsvg_filter_primitive_get_bounds (RsvgFilterPrimitive * self, RsvgFilterContext
             if (ctx->filter->primitiveunits == objectBoundingBox)
                 _rsvg_push_view_box (ctx->ctx, 1., 1.);
             if (self->x.factor != 'n')
-                otherbox.x = _rsvg_css_normalize_length (&self->x, ctx->ctx, 'h');
+                otherbox.rect.x = _rsvg_css_normalize_length (&self->x, ctx->ctx, 'h');
             else
-                otherbox.x = 0;
+                otherbox.rect.x = 0;
             if (self->y.factor != 'n')
-                otherbox.y = _rsvg_css_normalize_length (&self->y, ctx->ctx, 'v');
+                otherbox.rect.y = _rsvg_css_normalize_length (&self->y, ctx->ctx, 'v');
             else
-                otherbox.y = 0;
+                otherbox.rect.y = 0;
             if (self->width.factor != 'n')
-                otherbox.w = _rsvg_css_normalize_length (&self->width, ctx->ctx, 'h');
+                otherbox.rect.width = _rsvg_css_normalize_length (&self->width, ctx->ctx, 'h');
             else
-                otherbox.w = ctx->ctx->vb.w;
+                otherbox.rect.width = ctx->ctx->vb.rect.width;
             if (self->height.factor != 'n')
-                otherbox.h = _rsvg_css_normalize_length (&self->height, ctx->ctx, 'v');
+                otherbox.rect.height = _rsvg_css_normalize_length (&self->height, ctx->ctx, 'v');
             else
-                otherbox.h = ctx->ctx->vb.h;
+                otherbox.rect.height = ctx->ctx->vb.rect.height;
             if (ctx->filter->primitiveunits == objectBoundingBox)
                 _rsvg_pop_view_box (ctx->ctx);
             rsvg_bbox_clip (&box, &otherbox);
@@ -137,15 +137,15 @@ rsvg_filter_primitive_get_bounds (RsvgFilterPrimitive * self, RsvgFilterContext
 
     rsvg_bbox_init (&otherbox, affine);
     otherbox.virgin = 0;
-    otherbox.x = 0;
-    otherbox.y = 0;
-    otherbox.w = ctx->width;
-    otherbox.h = ctx->height;
+    otherbox.rect.x = 0;
+    otherbox.rect.y = 0;
+    otherbox.rect.width = ctx->width;
+    otherbox.rect.height = ctx->height;
     rsvg_bbox_clip (&box, &otherbox);
     {
-        RsvgIRect output = { box.x, box.y,
-            box.x + box.w,
-            box.y + box.h
+        RsvgIRect output = { box.rect.x, box.rect.y,
+            box.rect.x + box.rect.width,
+            box.rect.y + box.rect.height
         };
         return output;
     }
@@ -216,10 +216,10 @@ rsvg_filter_fix_coordinate_system (RsvgFilterContext * ctx, RsvgState * state, R
     int x, y, height, width;
     int i;
 
-    x = bbox.x;
-    y = bbox.y;
-    width = bbox.w;
-    height = bbox.h;
+    x = bbox.rect.x;
+    y = bbox.rect.y;
+    width = bbox.rect.width;
+    height = bbox.rect.height;
 
     ctx->width = gdk_pixbuf_get_width (ctx->source);
     ctx->height = gdk_pixbuf_get_height (ctx->source);
diff --git a/rsvg-marker.c b/rsvg-marker.c
index 21628fd..3d903a8 100644
--- a/rsvg-marker.c
+++ b/rsvg-marker.c
@@ -130,19 +130,21 @@ rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y, gdouble orient, gdo
         y = 0;
 
         rsvg_preserve_aspect_ratio (self->preserve_aspect_ratio,
-                                    self->vbox.w, self->vbox.h, &w, &h, &x, &y);
+                                    self->vbox.rect.width,
+                                    self->vbox.rect.height,
+                                    &w, &h, &x, &y);
 
-        x = -self->vbox.x * w / self->vbox.w;
-        y = -self->vbox.y * h / self->vbox.h;
+        x = -self->vbox.rect.x * w / self->vbox.rect.width;
+        y = -self->vbox.rect.y * h / self->vbox.rect.height;
 
-        taffine[0] = w / self->vbox.w;
+        taffine[0] = w / self->vbox.rect.width;
         taffine[1] = 0.;
         taffine[2] = 0.;
-        taffine[3] = h / self->vbox.h;
+        taffine[3] = h / self->vbox.rect.height;
         taffine[4] = x;
         taffine[5] = y;
         _rsvg_affine_multiply (affine, taffine, affine);
-        _rsvg_push_view_box (ctx, self->vbox.w, self->vbox.h);
+        _rsvg_push_view_box (ctx, self->vbox.rect.width, self->vbox.rect.height);
     }
     _rsvg_affine_translate (taffine,
                             -_rsvg_css_normalize_length (&self->refX, ctx, 'h'),
@@ -166,7 +168,8 @@ rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y, gdouble orient, gdo
 
     if (!state->overflow) {
         if (self->vbox.active)
-            rsvg_add_clipping_rect (ctx, self->vbox.x, self->vbox.y, self->vbox.w, self->vbox.h);
+            rsvg_add_clipping_rect (ctx, self->vbox.rect.x, self->vbox.rect.y,
+                                    self->vbox.rect.width, self->vbox.rect.height);
         else
             rsvg_add_clipping_rect (ctx, 0, 0,
                                     _rsvg_css_normalize_length (&self->width, ctx, 'h'),
diff --git a/rsvg-private.h b/rsvg-private.h
index a8dd2f9..4b2b7a9 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -27,6 +27,8 @@
 #ifndef RSVG_PRIVATE_H
 #define RSVG_PRIVATE_H
 
+#include <cairo.h>
+
 #include "rsvg.h"
 #include "rsvg-bpath-util.h"
 
@@ -177,8 +179,8 @@ struct RsvgHandlePrivate {
 };
 
 typedef struct {
+    cairo_rectangle_t rect;
     gboolean active;
-    double x, y, w, h;
 } RsvgViewBox;
 
 /*Contextual information for the drawing phase*/
@@ -248,7 +250,7 @@ struct _RsvgIRect {
 };
 
 typedef struct {
-    gdouble x, y, w, h;
+    cairo_rectangle_t rect;
     gboolean virgin;
     double affine[6];
 } RsvgBbox;
diff --git a/rsvg-structure.c b/rsvg-structure.c
index 572036c..3c218b6 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -231,20 +231,22 @@ rsvg_node_use_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
 
         if (symbol->vbox.active) {
             rsvg_preserve_aspect_ratio
-                (symbol->preserve_aspect_ratio, symbol->vbox.w, symbol->vbox.h, &w, &h, &x, &y);
+                (symbol->preserve_aspect_ratio,
+                 symbol->vbox.rect.width, symbol->vbox.rect.height,
+                 &w, &h, &x, &y);
 
             _rsvg_affine_translate (affine, x, y);
             _rsvg_affine_multiply (state->affine, affine, state->affine);
-            _rsvg_affine_scale (affine, w / symbol->vbox.w, h / symbol->vbox.h);
+            _rsvg_affine_scale (affine, w / symbol->vbox.rect.width, h / symbol->vbox.rect.height);
             _rsvg_affine_multiply (state->affine, affine, state->affine);
-            _rsvg_affine_translate (affine, -symbol->vbox.x, -symbol->vbox.y);
+            _rsvg_affine_translate (affine, -symbol->vbox.rect.x, -symbol->vbox.rect.y);
             _rsvg_affine_multiply (state->affine, affine, state->affine);
 
-            _rsvg_push_view_box (ctx, symbol->vbox.w, symbol->vbox.h);
+            _rsvg_push_view_box (ctx, symbol->vbox.rect.width, symbol->vbox.rect.height);
             rsvg_push_discrete_layer (ctx);
             if (!state->overflow || (!state->has_overflow && child->state->overflow))
-                rsvg_add_clipping_rect (ctx, symbol->vbox.x, symbol->vbox.y,
-                                        symbol->vbox.w, symbol->vbox.h);
+                rsvg_add_clipping_rect (ctx, symbol->vbox.rect.x, symbol->vbox.rect.y,
+                                        symbol->vbox.rect.width, symbol->vbox.rect.height);
         } else {
             _rsvg_affine_translate (affine, x, y);
             _rsvg_affine_multiply (state->affine, affine, state->affine);
@@ -286,15 +288,16 @@ rsvg_node_svg_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate)
     if (sself->vbox.active) {
         double x = nx, y = ny, w = nw, h = nh;
         rsvg_preserve_aspect_ratio (sself->preserve_aspect_ratio,
-                                    sself->vbox.w, sself->vbox.h, &w, &h, &x, &y);
-        affine[0] = w / sself->vbox.w;
+                                    sself->vbox.rect.width, sself->vbox.rect.height,
+                                    &w, &h, &x, &y);
+        affine[0] = w / sself->vbox.rect.width;
         affine[1] = 0;
         affine[2] = 0;
-        affine[3] = h / sself->vbox.h;
-        affine[4] = x - sself->vbox.x * w / sself->vbox.w;
-        affine[5] = y - sself->vbox.y * h / sself->vbox.h;
+        affine[3] = h / sself->vbox.rect.height;
+        affine[4] = x - sself->vbox.rect.x * w / sself->vbox.rect.width;
+        affine[5] = y - sself->vbox.rect.y * h / sself->vbox.rect.height;
         _rsvg_affine_multiply (state->affine, affine, state->affine);
-        _rsvg_push_view_box (ctx, sself->vbox.w, sself->vbox.h);
+        _rsvg_push_view_box (ctx, sself->vbox.rect.width, sself->vbox.rect.height);
     } else {
         affine[0] = 1;
         affine[1] = 0;



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