summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiko Kiirala <niko@kiirala.com>2009-03-28 12:01:17 +0000
committerkiirala <kiirala@users.sourceforge.net>2009-03-28 12:01:17 +0000
commit2cc76133e6025eaf4c010165ef18941f748f12be (patch)
tree1c919a719626ae5f656af89769165f7717e342a9
parentFixed some bad math in pixblock-scaler. Seems to fix shifted blurs (diff)
downloadinkscape-2cc76133e6025eaf4c010165ef18941f748f12be.tar.gz
inkscape-2cc76133e6025eaf4c010165ef18941f748f12be.zip
Made functions in nr-filter-utils inlineable
(bzr r7582)
-rw-r--r--src/display/nr-filter-utils.cpp19
-rw-r--r--src/display/nr-filter-utils.h22
-rw-r--r--src/display/pixblock-scaler.cpp5
3 files changed, 24 insertions, 22 deletions
diff --git a/src/display/nr-filter-utils.cpp b/src/display/nr-filter-utils.cpp
index e9e422094..d36c0beb5 100644
--- a/src/display/nr-filter-utils.cpp
+++ b/src/display/nr-filter-utils.cpp
@@ -3,23 +3,8 @@
namespace Inkscape {
namespace Filters {
-int clamp(int const val) {
- if (val < 0) return 0;
- if (val > 255) return 255;
- return val;
-}
-
-int clamp3(int const val) {
- if (val < 0) return 0;
- if (val > 16581375) return 16581375;
- return val;
-}
-
-int clamp_alpha(int const val, int const alpha) {
- if (val < 0) return 0;
- if (val > alpha) return alpha;
- return val;
-}
+/* Everything moved to .h, because they were short functions that should
+ * get inlined */
} /* namespace Filters */
} /* namespace Inkscape */
diff --git a/src/display/nr-filter-utils.h b/src/display/nr-filter-utils.h
index ccdaec1a8..c825a814e 100644
--- a/src/display/nr-filter-utils.h
+++ b/src/display/nr-filter-utils.h
@@ -14,7 +14,6 @@
#include "round.h"
-/* Shouldn't these be inlined? */
namespace Inkscape {
namespace Filters {
@@ -25,7 +24,12 @@ namespace Filters {
* \return 0 if the value is smaller than 0, 255 if it is greater 255, else v
* \param v the value to clamp
*/
-int clamp(int const val);
+__attribute__ ((const))
+inline int clamp(int const val) {
+ if (val < 0) return 0;
+ if (val > 255) return 255;
+ return val;
+}
/**
* Clamps an integer value to a value between 0 and 255^3.
@@ -33,7 +37,12 @@ int clamp(int const val);
* \return 0 if the value is smaller than 0, 255^3 (16581375) if it is greater than 255^3, else v
* \param v the value to clamp
*/
-int clamp3(int const val);
+__attribute__ ((const))
+inline int clamp3(int const val) {
+ if (val < 0) return 0;
+ if (val > 16581375) return 16581375;
+ return val;
+}
/**
* Macro to use the clamp function with double inputs and unsigned char output
@@ -48,7 +57,12 @@ int clamp3(int const val);
* \param val the value to clamp
* \param alpha the maximum value to clamp to
*/
-int clamp_alpha(int const val, int const alpha);
+__attribute__ ((const))
+inline int clamp_alpha(int const val, int const alpha) {
+ if (val < 0) return 0;
+ if (val > alpha) return alpha;
+ return val;
+}
} /* namespace Filters */
} /* namespace Inkscape */
diff --git a/src/display/pixblock-scaler.cpp b/src/display/pixblock-scaler.cpp
index 767334935..cefbfe4fb 100644
--- a/src/display/pixblock-scaler.cpp
+++ b/src/display/pixblock-scaler.cpp
@@ -13,7 +13,10 @@
#include <glib.h>
#include <cmath>
-using std::floor;
+#if defined (SOLARIS) && (SOLARIS == 8)
+#include "round.h"
+using Inkscape::round;
+#endif
#include "display/nr-filter-utils.h"
#include "libnr/nr-pixblock.h"