summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorPedro Giffuni <pfg@apache.org>2013-02-08 15:35:48 +0000
committerPedro Giffuni <pfg@apache.org>2013-02-08 15:35:48 +0000
commitd1f61b3f3564ca5421a13b77e4c7c78bb409e9e1 (patch)
tree416a9d8479d8ad53b5f8b129f680e1fb20f54f68 /vcl/inc
parent908088f614cda46d9c996e40579611df27276394 (diff)
A miscellaneous use of boost.
Sinc(x) is a simple function used in communications. boost happens to use it for quaternion math. The implementation is simple, however it looks fun to re-use the boost function even if just to say we are using quaternion math somewhere ;). The performance difference is not likely to be huge but JIC, set up a specific Boost math policy to limit type promotion with it's corresponding impact.
Notes
Notes: merged as: f31e6debfa7e330f985a0846a6ca91130d3dab20
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/vcl/bitmap.hxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 373aeefeff2f..fce0e86b6422 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -30,6 +30,17 @@
#include <tools/rc.hxx>
#include <vcl/region.hxx>
+#ifdef WNT
+#define _STLP_HAS_NATIVE_FLOAT_ABS
+#endif
+
+#include <boost/math/special_functions/sinc.hpp>
+
+using namespace boost::math::policies;
+typedef policy<
+ promote_double<false>
+> SincPolicy;
+
// -----------
// - Defines -
// -----------
@@ -261,8 +272,7 @@ public:
}
x *= M_PI;
-
- return sin(x) / x;
+ return boost::math::sinc_pi(x, SincPolicy());
}
};