summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-08-10 13:03:32 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-08-10 16:50:03 +0200
commit25694a5ccb552b3cbe8a9191e3d1490a3ec7eda1 (patch)
treed5bbdd1e783ef57a13aecc8cdd633d3bffb88c62
parentf05565193971376182db41c238b617c1463bd9d7 (diff)
Silence -Werror,-Wimplicit-int-float-conversion
> vcl/opengl/gdiimpl.cxx:2237:45: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion] > glClearColor(static_cast<float>(rand())/RAND_MAX, static_cast<float>(rand())/RAND_MAX, > ~^~~~~~~~ etc. with Clang 10, by doing the division with double precision. Change-Id: Ide74d29eb07ea24ea7fb318bba7a2892251a40f7 Reviewed-on: https://gerrit.libreoffice.org/77240 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--vcl/opengl/gdiimpl.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index d7187c9921cc..efbc4cea3682 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2234,8 +2234,9 @@ void OpenGLSalGraphicsImpl::doFlush()
mpWindowContext->state().stencil().disable();
#if OSL_DEBUG_LEVEL > 0 // random background glClear
- glClearColor(static_cast<float>(rand())/RAND_MAX, static_cast<float>(rand())/RAND_MAX,
- static_cast<float>(rand())/RAND_MAX, 1.0);
+ glClearColor(static_cast<float>(double(rand())/RAND_MAX),
+ static_cast<float>(double(rand())/RAND_MAX),
+ static_cast<float>(double(rand())/RAND_MAX), 1.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
CHECK_GL_ERROR();
#endif