diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-05-16 10:16:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-05-17 08:22:14 +0200 |
commit | 7ab34b51f2d45137191145d31b4b0c7d18f577bf (patch) | |
tree | abb760e86740a0e073008047d966af250e8c8c5d /slideshow | |
parent | f8e3ad02737854686a590f7f8f02eb72e03a0f8e (diff) |
loplugin:redundantcast improvements for floating-integer conversions
Change-Id: I63dbf18f144a792ae775fe6706da81657f790016
Reviewed-on: https://gerrit.libreoffice.org/54416
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/transitions/snakewipe.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/slideshow/source/engine/transitions/snakewipe.cxx b/slideshow/source/engine/transitions/snakewipe.cxx index dd15d1238deb..b484f36cb8d7 100644 --- a/slideshow/source/engine/transitions/snakewipe.cxx +++ b/slideshow/source/engine/transitions/snakewipe.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cmath> #include <osl/diagnose.h> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -87,7 +90,7 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) if (in) { const double sqrtArea2 = sqrt( t * m_sqrtElements * m_sqrtElements ); const double edge = ::basegfx::pruneScaleValue( - static_cast<double>( static_cast<sal_Int32>(sqrtArea2) ) / + std::trunc(sqrtArea2) / m_sqrtElements ); ::basegfx::B2DPolygon poly; @@ -99,7 +102,8 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) res.append(poly); } const double a = (M_SQRT1_2 / m_sqrtElements); - const double d = (sqrtArea2 - static_cast<sal_Int32>(sqrtArea2)); + double dummy; + const double d = std::modf(sqrtArea2, &dummy); const double len = (t * M_SQRT2 * d); const double height = ::basegfx::pruneScaleValue( M_SQRT1_2 / m_sqrtElements ); poly.clear(); @@ -130,7 +134,7 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) { const double sqrtArea2 = sqrt( t * m_sqrtElements * m_sqrtElements ); const double edge = ::basegfx::pruneScaleValue( - static_cast<double>( static_cast<sal_Int32>(sqrtArea2) ) / + std::trunc(sqrtArea2) / m_sqrtElements ); ::basegfx::B2DPolygon poly; @@ -143,7 +147,8 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) res.append(poly); } const double a = (M_SQRT1_2 / m_sqrtElements); - const double d = (sqrtArea2 - static_cast<sal_Int32>(sqrtArea2)); + double dummy; + const double d = std::modf(sqrtArea2, &dummy); const double len = ((1.0 - t) * M_SQRT2 * d); const double height = ::basegfx::pruneScaleValue( M_SQRT1_2 / m_sqrtElements ); poly.clear(); |