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 /vcl | |
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 'vcl')
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 3 | ||||
-rw-r--r-- | vcl/opengl/scale.cxx | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index df4996a6ca09..6858a2adbae7 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -39,6 +39,7 @@ #include <opengl/VertexUtils.hxx> #include <opengl/BufferObject.hxx> +#include <cmath> #include <vector> #include <glm/gtc/type_ptr.hpp> @@ -1071,7 +1072,7 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture( if( ixscale >= 2 && iyscale >= 2 ) // scale ratio less than 50% { areaScaling = true; - fastAreaScaling = ( ixscale == int( ixscale ) && iyscale == int( iyscale )); + fastAreaScaling = ( ixscale == std::trunc( ixscale ) && iyscale == std::trunc( iyscale )); // The generic case has arrays only up to 16 ratio downscaling and is performed in 2 passes, // when the ratio is in the 16-100 range, which is hopefully enough in practice, but protect // against buffer overflows in case such an extreme case happens (and in such case the precision diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx index 433ad19f2e8b..a5280bf70817 100644 --- a/vcl/opengl/scale.cxx +++ b/vcl/opengl/scale.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> +#include <cmath> + #include <vcl/opengl/OpenGLHelper.hxx> #include <vcl/bitmap.hxx> @@ -203,7 +205,7 @@ bool OpenGLSalBitmap::ImplScaleArea( const rtl::Reference< OpenGLContext > &xCon double ixscale = 1 / rScaleX; double iyscale = 1 / rScaleY; - bool fast = ( ixscale == int( ixscale ) && iyscale == int( iyscale ) + bool fast = ( ixscale == std::trunc( ixscale ) && iyscale == std::trunc( iyscale ) && int( nNewWidth * ixscale ) == mnWidth && int( nNewHeight * iyscale ) == mnHeight ); bool bTwoPasses = false; |