[librsvg] Removed rsvg_css_parse_aspect_ratio(); use the Rust rsvg_aspect_ratio_parse() instead
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Removed rsvg_css_parse_aspect_ratio(); use the Rust rsvg_aspect_ratio_parse() instead
- Date: Thu, 2 Feb 2017 04:00:49 +0000 (UTC)
commit 26c2dc2be6b28294100b215ba53438ce823c80bf
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 1 14:54:46 2017 -0600
Removed rsvg_css_parse_aspect_ratio(); use the Rust rsvg_aspect_ratio_parse() instead
rsvg-css.c | 44 --------------------------------------------
rsvg-css.h | 4 ++++
rsvg-image.c | 4 ++--
rsvg-image.h | 4 ++--
rsvg-marker.c | 4 ++--
rsvg-paint-server.c | 2 +-
rsvg-paint-server.h | 2 +-
rsvg-structure.c | 4 ++--
rsvg-structure.h | 4 ++--
9 files changed, 16 insertions(+), 56 deletions(-)
---
diff --git a/rsvg-css.c b/rsvg-css.c
index 1637392..442c6c9 100644
--- a/rsvg-css.c
+++ b/rsvg-css.c
@@ -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)
{
diff --git a/rsvg-css.h b/rsvg-css.h
index e8f3975..3b50913 100644
--- a/rsvg-css.h
+++ b/rsvg-css.h
@@ -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
diff --git a/rsvg-image.c b/rsvg-image.c
index 233630d..76c9df4 100644
--- a/rsvg-image.c
+++ b/rsvg-image.c
@@ -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 *
diff --git a/rsvg-image.h b/rsvg-image.h
index 9cb0f85..4d7644b 100644
--- a/rsvg-image.h
+++ b/rsvg-image.h
@@ -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);
diff --git a/rsvg-marker.c b/rsvg-marker.c
index 8e44f02..bcd6fca 100644
--- a/rsvg-marker.c
+++ b/rsvg-marker.c
@@ -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 *
diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c
index c465c29..0977be6 100644
--- a/rsvg-paint-server.c
+++ b/rsvg-paint-server.c
@@ -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;
}
}
diff --git a/rsvg-paint-server.h b/rsvg-paint-server.h
index a0e069d..1083a1b 100644
--- a/rsvg-paint-server.h
+++ b/rsvg-paint-server.h
@@ -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;
diff --git a/rsvg-structure.c b/rsvg-structure.c
index 0d8af08..6fc1446 100644
--- a/rsvg-structure.c
+++ b/rsvg-structure.c
@@ -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);
}
diff --git a/rsvg-structure.h b/rsvg-structure.h
index 03d4694..c7e1bc4 100644
--- a/rsvg-structure.h
+++ b/rsvg-structure.h
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]