summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 206d2ab)
raw | patch | inline | side by side (parent: 206d2ab)
author | kiirala <kiirala@users.sourceforge.net> | |
Sat, 28 Mar 2009 12:01:17 +0000 (12:01 +0000) | ||
committer | kiirala <kiirala@users.sourceforge.net> | |
Sat, 28 Mar 2009 12:01:17 +0000 (12:01 +0000) |
src/display/nr-filter-utils.cpp | patch | blob | history | |
src/display/nr-filter-utils.h | patch | blob | history | |
src/display/pixblock-scaler.cpp | patch | blob | history |
index e9e422094fc1ca1d17e25d4e6096e62f43cd41d9..d36c0beb5bdb0efcf46331b2d7575f090e5bafd0 100644 (file)
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 */
index ccdaec1a8ed4ad1ac18d91fbe69f2105006afa3e..c825a814ed00c58a7f634f8ee909ab87fb9cc9ab 100644 (file)
#include "round.h"
-/* Shouldn't these be inlined? */
namespace Inkscape {
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.
* \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
* \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 */
index 7673349353061852d1693863f6ef7f5fe957ec2f..cefbfe4fbe5db4774d3f86b087fa6606267b1f57 100644 (file)
#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"