[librsvg/rustification] Make viewport_percentage() internal to rsvg-css.c
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] Make viewport_percentage() internal to rsvg-css.c
- Date: Thu, 17 Nov 2016 00:29:03 +0000 (UTC)
commit 66f7394503b4ed180d84735dd80382bc278abe41
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 16 15:12:03 2016 -0600
Make viewport_percentage() internal to rsvg-css.c
This is only used in _rsvg_css_normalize_length() anyway.
Also, remove an unused function.
rsvg-css.c | 16 ++++++++++++++--
rsvg-styles.c | 18 ------------------
rsvg-styles.h | 5 -----
3 files changed, 14 insertions(+), 25 deletions(-)
---
diff --git a/rsvg-css.c b/rsvg-css.c
index a601fff..21d5027 100644
--- a/rsvg-css.c
+++ b/rsvg-css.c
@@ -122,6 +122,18 @@ rsvg_drawing_ctx_get_normalized_font_size (RsvgDrawingCtx *ctx)
return normalize_font_size (rsvg_current_state (ctx), ctx);
}
+static double
+viewport_percentage (double width, double height)
+{
+ /* https://www.w3.org/TR/SVG/coords.html#Units
+ *
+ * "For any other length value expressed as a percentage of the viewport, the
+ * percentage is calculated as the specified percentage of
+ * sqrt((actual-width)**2 + (actual-height)**2))/sqrt(2)."
+ */
+ return sqrt (width * width + height * height) / M_SQRT2;
+}
+
double
_rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx)
{
@@ -140,7 +152,7 @@ _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx)
return in->length * h;
case LENGTH_DIR_BOTH:
- return in->length * rsvg_viewport_percentage (w, h);
+ return in->length * viewport_percentage (w, h);
}
} else if (in->unit == LENGTH_UNIT_FONT_EM || in->unit == LENGTH_UNIT_FONT_EX) {
double font = rsvg_drawing_ctx_get_normalized_font_size (ctx);
@@ -161,7 +173,7 @@ _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx)
return in->length * dpi_y;
case LENGTH_DIR_BOTH:
- return in->length * rsvg_viewport_percentage (dpi_x, dpi_y);
+ return in->length * viewport_percentage (dpi_x, dpi_y);
}
} else if (in->unit == LENGTH_UNIT_RELATIVE_LARGER) {
/* todo: "larger" */
diff --git a/rsvg-styles.c b/rsvg-styles.c
index eea61dc..c5bdef4 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -96,24 +96,6 @@ style_value_data_free (StyleValueData *value)
g_free (value);
}
-gdouble
-rsvg_viewport_percentage (gdouble width, gdouble height)
-{
- /* https://www.w3.org/TR/SVG/coords.html#Units
- *
- * "For any other length value expressed as a percentage of the viewport, the
- * percentage is calculated as the specified percentage of
- * sqrt((actual-width)**2 + (actual-height)**2))/sqrt(2)."
- */
- return sqrt (width * width + height * height) / M_SQRT2;
-}
-
-gdouble
-rsvg_dpi_percentage (RsvgHandle * ctx)
-{
- return sqrt (ctx->priv->dpi_x * ctx->priv->dpi_y);
-}
-
static void
rsvg_state_init (RsvgState * state)
{
diff --git a/rsvg-styles.h b/rsvg-styles.h
index bf64833..b4d5962 100644
--- a/rsvg-styles.h
+++ b/rsvg-styles.h
@@ -216,11 +216,6 @@ void rsvg_parse_style_attrs (RsvgHandle * ctx, RsvgState * state, const char *ta
const char *klazz, const char *id, RsvgPropertyBag * atts);
G_GNUC_INTERNAL
-gdouble rsvg_viewport_percentage (gdouble width, gdouble height);
-G_GNUC_INTERNAL
-gdouble rsvg_dpi_percentage (RsvgHandle * ctx);
-
-G_GNUC_INTERNAL
gboolean rsvg_parse_transform (cairo_matrix_t *matrix, const char *src);
G_GNUC_INTERNAL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]