diff options
Diffstat (limited to 'slideshow/source/engine/activities/interpolation.hxx')
-rw-r--r-- | slideshow/source/engine/activities/interpolation.hxx | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/slideshow/source/engine/activities/interpolation.hxx b/slideshow/source/engine/activities/interpolation.hxx index 12fa27ffb1ea..5efa0f01527f 100644 --- a/slideshow/source/engine/activities/interpolation.hxx +++ b/slideshow/source/engine/activities/interpolation.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,38 +43,38 @@ namespace basegfx // not-straight-forward-interpolatable types /// Specialization for RGBColor, to employ color-specific interpolator - template<> ::slideshow::internal::RGBColor lerp< ::slideshow::internal::RGBColor >( - const ::slideshow::internal::RGBColor& rFrom, - const ::slideshow::internal::RGBColor& rTo, - double t ) + template<> ::slideshow::internal::RGBColor lerp< ::slideshow::internal::RGBColor >( + const ::slideshow::internal::RGBColor& rFrom, + const ::slideshow::internal::RGBColor& rTo, + double t ) { return interpolate( rFrom, rTo, t ); } - + /// Specialization also for sal_Int16, although this code should not be called - template<> sal_Int16 lerp< sal_Int16 >( const sal_Int16&, - const sal_Int16& rTo, - double ) + template<> sal_Int16 lerp< sal_Int16 >( const sal_Int16&, + const sal_Int16& rTo, + double ) { OSL_ENSURE( false, "lerp<sal_Int16> called" ); return rTo; } - + /// Specialization also for string, although this code should not be called - template<> ::rtl::OUString lerp< ::rtl::OUString >( const ::rtl::OUString&, - const ::rtl::OUString& rTo, - double ) + template<> ::rtl::OUString lerp< ::rtl::OUString >( const ::rtl::OUString&, + const ::rtl::OUString& rTo, + double ) { OSL_ENSURE( false, "lerp<::rtl::OUString> called" ); return rTo; } - + /// Specialization also for bool, although this code should not be called - template<> bool lerp< bool >( const bool&, - const bool& rTo, - double ) + template<> bool lerp< bool >( const bool&, + const bool& rTo, + double ) { OSL_ENSURE( false, "lerp<bool> called" ); @@ -82,21 +82,21 @@ namespace basegfx } } } - + namespace slideshow { namespace internal { template< typename ValueType > struct Interpolator { - ValueType operator()( const ValueType& rFrom, - const ValueType& rTo, - double t ) const + ValueType operator()( const ValueType& rFrom, + const ValueType& rTo, + double t ) const { return basegfx::tools::lerp( rFrom, rTo, t ); } }; - + /// Specialization for HSLColor, to employ color-specific interpolator template<> struct Interpolator< HSLColor > { @@ -105,9 +105,9 @@ namespace slideshow { } - HSLColor operator()( const HSLColor& rFrom, - const HSLColor& rTo, - double t ) const + HSLColor operator()( const HSLColor& rFrom, + const HSLColor& rTo, + double t ) const { return interpolate( rFrom, rTo, t, mbCCW ); } @@ -134,10 +134,10 @@ namespace slideshow Total number of frames. Should be greater than zero. */ template< typename ValueType > ValueType lerp( const Interpolator< ValueType >& rInterpolator, - const ValueType& rFrom, - const ValueType& rTo, - sal_uInt32 nFrame, - ::std::size_t nTotalFrames ) + const ValueType& rFrom, + const ValueType& rTo, + sal_uInt32 nFrame, + ::std::size_t nTotalFrames ) { // TODO(P1): There's a nice HAKMEM trick for that // nTotalFrames > 1 condition below @@ -149,42 +149,42 @@ namespace slideshow } /// Specialization for non-interpolatable constants/enums - template<> sal_Int16 lerp< sal_Int16 >( const Interpolator< sal_Int16 >& /*rInterpolator*/, - const sal_Int16& rFrom, - const sal_Int16& rTo, - sal_uInt32 nFrame, - ::std::size_t nTotalFrames ) + template<> sal_Int16 lerp< sal_Int16 >( const Interpolator< sal_Int16 >& /*rInterpolator*/, + const sal_Int16& rFrom, + const sal_Int16& rTo, + sal_uInt32 nFrame, + ::std::size_t nTotalFrames ) { // until one half of the total frames are over, take from value. - // after that, take to value. + // after that, take to value. // For nFrames not divisable by 2, we prefer to over from, which // also neatly yields to for 1 frame activities return nFrame < nTotalFrames/2 ? rFrom : rTo; } /// Specialization for non-interpolatable strings - template<> ::rtl::OUString lerp< ::rtl::OUString >( const Interpolator< ::rtl::OUString >& /*rInterpolator*/, - const ::rtl::OUString& rFrom, - const ::rtl::OUString& rTo, - sal_uInt32 nFrame, - ::std::size_t nTotalFrames ) + template<> ::rtl::OUString lerp< ::rtl::OUString >( const Interpolator< ::rtl::OUString >& /*rInterpolator*/, + const ::rtl::OUString& rFrom, + const ::rtl::OUString& rTo, + sal_uInt32 nFrame, + ::std::size_t nTotalFrames ) { // until one half of the total frames are over, take from value. - // after that, take to value. + // after that, take to value. // For nFrames not divisable by 2, we prefer to over from, which // also neatly yields to for 1 frame activities return nFrame < nTotalFrames/2 ? rFrom : rTo; } /// Specialization for non-interpolatable bools - template<> bool lerp< bool >( const Interpolator< bool >& /*rInterpolator*/, - const bool& bFrom, - const bool& bTo, - sal_uInt32 nFrame, - ::std::size_t nTotalFrames ) + template<> bool lerp< bool >( const Interpolator< bool >& /*rInterpolator*/, + const bool& bFrom, + const bool& bTo, + sal_uInt32 nFrame, + ::std::size_t nTotalFrames ) { // until one half of the total frames are over, take from value. - // after that, take to value. + // after that, take to value. // For nFrames not divisable by 2, we prefer to over from, which // also neatly yields to for 1 frame activities return nFrame < nTotalFrames/2 ? bFrom : bTo; |