Removed rsvg_css_parse_aspect_ratio(); use the Rust rsvg_aspect_ratio_parse() instead

parent 0cde6ad5
......@@ -623,50 +623,6 @@ rsvg_css_parse_number_optional_number (const char *str, double *x, double *y)
*y = *x;
}
int
rsvg_css_parse_aspect_ratio (const char *str)
{
char **elems;
guint nb_elems;
int ratio = RSVG_ASPECT_RATIO_NONE;
elems = rsvg_css_parse_list (str, &nb_elems);
if (elems && nb_elems) {
guint i;
for (i = 0; i < nb_elems; i++) {
if (!strcmp (elems[i], "xMinYMin"))
ratio = RSVG_ASPECT_RATIO_XMIN_YMIN;
else if (!strcmp (elems[i], "xMidYMin"))
ratio = RSVG_ASPECT_RATIO_XMID_YMIN;
else if (!strcmp (elems[i], "xMaxYMin"))
ratio = RSVG_ASPECT_RATIO_XMAX_YMIN;
else if (!strcmp (elems[i], "xMinYMid"))
ratio = RSVG_ASPECT_RATIO_XMIN_YMID;
else if (!strcmp (elems[i], "xMidYMid"))
ratio = RSVG_ASPECT_RATIO_XMID_YMID;
else if (!strcmp (elems[i], "xMaxYMid"))
ratio = RSVG_ASPECT_RATIO_XMAX_YMID;
else if (!strcmp (elems[i], "xMinYMax"))
ratio = RSVG_ASPECT_RATIO_XMIN_YMAX;
else if (!strcmp (elems[i], "xMidYMax"))
ratio = RSVG_ASPECT_RATIO_XMID_YMAX;
else if (!strcmp (elems[i], "xMaxYMax"))
ratio = RSVG_ASPECT_RATIO_XMAX_YMAX;
else if (!strcmp (elems[i], "slice"))
ratio |= RSVG_ASPECT_RATIO_SLICE;
else if (!strcmp (elems[i], "defer"))
ratio |= RSVG_ASPECT_RATIO_DEFER;
}
g_strfreev (elems);
}
return ratio;
}
gboolean
rsvg_css_parse_overflow (const char *str, gboolean * inherit)
{
......
......@@ -53,6 +53,10 @@ guint32 rsvg_css_parse_color (const char *str, gboolean * inherit);
#ifdef RSVG_COMPILATION
/* This is implemented in rust/src/aspect_ratio.rs */
G_GNUC_INTERNAL
guint32 rsvg_aspect_ratio_parse (const char *str);
G_GNUC_INTERNAL
int rsvg_css_parse_aspect_ratio (const char *str);
G_GNUC_INTERNAL
......
......@@ -113,7 +113,7 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle,
}
void
rsvg_preserve_aspect_ratio (unsigned int aspect_ratio, double width,
rsvg_preserve_aspect_ratio (guint32 aspect_ratio, double width,
double height, double *w, double *h, double *x, double *y)
{
double neww, newh;
......@@ -224,7 +224,7 @@ rsvg_node_image_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * a
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
image->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
image->preserve_aspect_ratio = rsvg_aspect_ratio_parse (value);
}
RsvgNode *
......
......@@ -43,13 +43,13 @@ typedef struct _RsvgNodeImage RsvgNodeImage;
struct _RsvgNodeImage {
RsvgNode super;
gint preserve_aspect_ratio;
guint32 preserve_aspect_ratio;
RsvgLength x, y, w, h;
cairo_surface_t *surface; /* a cairo image surface */
};
G_GNUC_INTERNAL
void rsvg_preserve_aspect_ratio (unsigned int aspect_ratio, double width,
void rsvg_preserve_aspect_ratio (guint32 aspect_ratio, double width,
double height, double *w, double *h, double *x, double *y);
G_GNUC_INTERNAL
cairo_surface_t *rsvg_cairo_surface_new_from_href (RsvgHandle *handle, const char *href, GError ** error);
......
......@@ -47,7 +47,7 @@ struct _RsvgMarker {
gboolean bbox;
RsvgLength refX, refY, width, height;
double orient;
gint preserve_aspect_ratio;
guint32 preserve_aspect_ratio;
gboolean orientAuto;
RsvgViewBox vbox;
};
......@@ -83,7 +83,7 @@ rsvg_node_marker_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
marker->bbox = TRUE;
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
marker->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
marker->preserve_aspect_ratio = rsvg_aspect_ratio_parse (value);
}
RsvgNode *
......
......@@ -464,7 +464,7 @@ rsvg_pattern_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts
pattern->hascbox = TRUE;
}
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio"))) {
pattern->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
pattern->preserve_aspect_ratio = rsvg_aspect_ratio_parse (value);
pattern->hasaspect = TRUE;
}
}
......
......@@ -135,7 +135,7 @@ struct _RsvgPattern {
cairo_matrix_t affine; /* user space to actual at time of gradient def */
RsvgLength x, y, width, height;
RsvgViewBox vbox;
unsigned int preserve_aspect_ratio;
guint32 preserve_aspect_ratio;
int hasx:1;
int hasy:1;
int hasvbox:1;
......
......@@ -332,7 +332,7 @@ rsvg_node_svg_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * att
svg->vbox = rsvg_css_parse_vbox (value);
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
svg->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
svg->preserve_aspect_ratio = rsvg_aspect_ratio_parse (value);
if ((value = rsvg_property_bag_lookup (atts, "width")))
svg->w = rsvg_length_parse (value, LENGTH_DIR_HORIZONTAL);
if ((value = rsvg_property_bag_lookup (atts, "height")))
......@@ -466,7 +466,7 @@ rsvg_node_symbol_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag *
if ((value = rsvg_property_bag_lookup (atts, "viewBox")))
symbol->vbox = rsvg_css_parse_vbox (value);
if ((value = rsvg_property_bag_lookup (atts, "preserveAspectRatio")))
symbol->preserve_aspect_ratio = rsvg_css_parse_aspect_ratio (value);
symbol->preserve_aspect_ratio = rsvg_aspect_ratio_parse (value);
}
......
......@@ -60,7 +60,7 @@ struct _RsvgNodeGroup {
struct _RsvgNodeSymbol {
RsvgNode super;
gint preserve_aspect_ratio;
guint32 preserve_aspect_ratio;
RsvgViewBox vbox;
};
......@@ -72,7 +72,7 @@ struct _RsvgNodeUse {
struct _RsvgNodeSvg {
RsvgNode super;
gint preserve_aspect_ratio;
guint32 preserve_aspect_ratio;
RsvgLength x, y, w, h;
RsvgViewBox vbox;
RsvgPropertyBag *atts;
......
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