From f98bc4fc2b4ee72903da2a43ec3bc7d106eefed4 Mon Sep 17 00:00:00 2001 From: pjrm Date: Mon, 13 Jul 2009 03:24:24 +0000 Subject: [PATCH] sp-star.cpp, star-context.cpp: s/CLAMP/NR_CLAMP/, to make clear (and ensure) that we're using the libnr version rather than the glib version. (This change is probably desirable in most of Inkscape, but star-related code in particular is known to be sensitive to the difference.) --- src/sp-star.cpp | 8 ++++---- src/star-context.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 3c8754a11..71c9ad1c7 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -174,7 +174,7 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) case SP_ATTR_SODIPODI_SIDES: if (value) { star->sides = atoi (value); - star->sides = CLAMP (star->sides, 3, 1024); + star->sides = NR_CLAMP(star->sides, 3, 1024); } else { star->sides = 5; } @@ -512,13 +512,13 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); - star->sides = CLAMP (sides, 3, 1024); + star->sides = NR_CLAMP(sides, 3, 1024); star->center = center; star->r[0] = MAX (r1, 0.001); if (isflat == false) { - star->r[1] = CLAMP (r2, 0.0, star->r[0]); + star->r[1] = NR_CLAMP(r2, 0.0, star->r[0]); } else { - star->r[1] = CLAMP ( r1*cos(M_PI/sides) ,0.0, star->r[0] ); + star->r[1] = NR_CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); } star->arg[0] = arg1; star->arg[1] = arg2; diff --git a/src/star-context.cpp b/src/star-context.cpp index c5eff3c6a..f0c64e875 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -34,6 +34,7 @@ #include "desktop.h" #include "desktop-style.h" #include "message-context.h" +#include "libnr/nr-macros.h" #include "pixmaps/cursor-star.xpm" #include "sp-metrics.h" #include @@ -204,9 +205,9 @@ sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val) Glib::ustring path = val->getEntryName(); if (path == "magnitude") { - sc->magnitude = CLAMP (val->getInt(5), 3, 1024); + sc->magnitude = NR_CLAMP(val->getInt(5), 3, 1024); } else if (path == "proportion") { - sc->proportion = CLAMP (val->getDouble(0.5), 0.01, 2.0); + sc->proportion = NR_CLAMP(val->getDouble(0.5), 0.01, 2.0); } else if (path == "isflatsided") { sc->isflatsided = val->getBool(); } else if (path == "rounded") { -- 2.30.2