[Libreoffice-commits] core.git: include/vcl

Pedro Giffuni pfg at apache.org
Fri May 24 10:54:59 PDT 2013


 include/vcl/bitmap.hxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit f31e6debfa7e330f985a0846a6ca91130d3dab20
Author: Pedro Giffuni <pfg at apache.org>
Date:   Fri Feb 8 15:35:48 2013 +0000

    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.
    (cherry picked from commit d1f61b3f3564ca5421a13b77e4c7c78bb409e9e1)
    
    Conflicts:
    	vcl/inc/vcl/bitmap.hxx
    
    Change-Id: I5f01db1688eedee25a2943ca3aa6e957b400c759

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index bacec11..4ca9cc1 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -20,6 +20,7 @@
 #ifndef _SV_BITMAP_HXX
 #define _SV_BITMAP_HXX
 
+#include <boost/math/special_functions/sinc.hpp>
 #include <tools/color.hxx>
 #include <tools/link.hxx>
 #include <tools/solar.h>
@@ -207,7 +208,8 @@ public:
 
 class Lanczos3Kernel : public Kernel
 {
-
+    typedef boost::math::policies::policy<
+        boost::math::policies::promote_double<false> > SincPolicy;
 public:
     Lanczos3Kernel() : Kernel () {}
     virtual double GetWidth() const { return 3.0; }
@@ -223,7 +225,7 @@ public:
             return 1.0;
         }
         x = x * M_PI;
-        return sin(x) / x;
+        return boost::math::sinc_pi(x, SincPolicy());
     }
 };
 


More information about the Libreoffice-commits mailing list