diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:10:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:10:40 +0100 |
commit | 55f07d4daa76503530d96b9c20b53c59bcd5bcf9 (patch) | |
tree | 7ad8a720341e38258dab12597d25616c3bff8807 /vcl/opengl | |
parent | e235da515af0e2a5d5a0cf80773943b65fdb8f7b (diff) |
More loplugin:cstylecast: vcl
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I363c01a1ae9e863fca4fb4589829492d7280d711
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/framebuffer.cxx | 10 | ||||
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 4 | ||||
-rw-r--r-- | vcl/opengl/program.cxx | 32 | ||||
-rw-r--r-- | vcl/opengl/scale.cxx | 4 | ||||
-rw-r--r-- | vcl/opengl/texture.cxx | 20 |
5 files changed, 35 insertions, 35 deletions
diff --git a/vcl/opengl/framebuffer.cxx b/vcl/opengl/framebuffer.cxx index cb91ea482b79..db957d1a6cd0 100644 --- a/vcl/opengl/framebuffer.cxx +++ b/vcl/opengl/framebuffer.cxx @@ -22,19 +22,19 @@ OpenGLFramebuffer::OpenGLFramebuffer() : { glGenFramebuffers( 1, &mnId ); CHECK_GL_ERROR(); - VCL_GL_INFO( "Created framebuffer " << (int)mnId ); + VCL_GL_INFO( "Created framebuffer " << static_cast<int>(mnId) ); } OpenGLFramebuffer::~OpenGLFramebuffer() { glDeleteFramebuffers( 1, &mnId ); - VCL_GL_INFO( "Deleted framebuffer " << (int)mnId ); + VCL_GL_INFO( "Deleted framebuffer " << static_cast<int>(mnId) ); CHECK_GL_ERROR(); } void OpenGLFramebuffer::Bind(GLenum eTarget) { - VCL_GL_INFO( "Binding framebuffer " << (int)mnId ); + VCL_GL_INFO( "Binding framebuffer " << static_cast<int>(mnId) ); glBindFramebuffer(eTarget, mnId); CHECK_GL_ERROR(); } @@ -66,7 +66,7 @@ void OpenGLFramebuffer::AttachTexture( const OpenGLTexture& rTexture ) if( rTexture.Id() == mnAttachedTexture ) return; - VCL_GL_INFO( "Attaching texture " << rTexture.Id() << " to framebuffer " << (int)mnId ); + VCL_GL_INFO( "Attaching texture " << rTexture.Id() << " to framebuffer " << static_cast<int>(mnId) ); mnAttachedTexture = rTexture.Id(); mnWidth = rTexture.GetWidth(); mnHeight = rTexture.GetHeight(); @@ -76,7 +76,7 @@ void OpenGLFramebuffer::AttachTexture( const OpenGLTexture& rTexture ) GLuint nStencil = rTexture.StencilId(); if( nStencil ) { - VCL_GL_INFO( "Attaching stencil " << nStencil << " to framebuffer " << (int)mnId ); + VCL_GL_INFO( "Attaching stencil " << nStencil << " to framebuffer " << static_cast<int>(mnId) ); glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, nStencil ); CHECK_GL_ERROR(); diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 110071042519..608b28dbb927 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -2128,8 +2128,8 @@ void OpenGLSalGraphicsImpl::doFlush() mpWindowContext->state().stencil().disable(); #if OSL_DEBUG_LEVEL > 0 // random background glClear - glClearColor((float)rand()/RAND_MAX, (float)rand()/RAND_MAX, - (float)rand()/RAND_MAX, 1.0); + glClearColor(static_cast<float>(rand())/RAND_MAX, static_cast<float>(rand())/RAND_MAX, + static_cast<float>(rand())/RAND_MAX, 1.0); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); CHECK_GL_ERROR(); #endif diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx index 54b71c24cb49..6c3a03df14b4 100644 --- a/vcl/opengl/program.cxx +++ b/vcl/opengl/program.cxx @@ -238,9 +238,9 @@ void OpenGLProgram::SetColor( const OString& rName, SalColor nColor, sal_uInt8 n { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - ((float) SALCOLOR_RED( nColor )) / 255, - ((float) SALCOLOR_GREEN( nColor )) / 255, - ((float) SALCOLOR_BLUE( nColor )) / 255, + static_cast<float>(SALCOLOR_RED( nColor )) / 255, + static_cast<float>(SALCOLOR_GREEN( nColor )) / 255, + static_cast<float>(SALCOLOR_BLUE( nColor )) / 255, (100 - nTransparency) * (1.0 / 100) ); CHECK_GL_ERROR(); @@ -252,9 +252,9 @@ void OpenGLProgram::SetColorf( const OString& rName, SalColor nColor, double fTr { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - ((float) SALCOLOR_RED( nColor )) / 255, - ((float) SALCOLOR_GREEN( nColor )) / 255, - ((float) SALCOLOR_BLUE( nColor )) / 255, + static_cast<float>(SALCOLOR_RED( nColor )) / 255, + static_cast<float>(SALCOLOR_GREEN( nColor )) / 255, + static_cast<float>(SALCOLOR_BLUE( nColor )) / 255, (1.0f - fTransparency) ); CHECK_GL_ERROR(); @@ -266,10 +266,10 @@ void OpenGLProgram::SetColor( const OString& rName, const Color& rColor ) { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - ((float) rColor.GetRed()) / 255, - ((float) rColor.GetGreen()) / 255, - ((float) rColor.GetBlue()) / 255, - 1.0f - ((float) rColor.GetTransparency()) / 255 ); + static_cast<float>(rColor.GetRed()) / 255, + static_cast<float>(rColor.GetGreen()) / 255, + static_cast<float>(rColor.GetBlue()) / 255, + 1.0f - static_cast<float>(rColor.GetTransparency()) / 255 ); CHECK_GL_ERROR(); if( rColor.GetTransparency() > 0 ) @@ -280,9 +280,9 @@ void OpenGLProgram::SetColorWithIntensity( const OString& rName, const Color& rC { GLuint nUniform = GetUniformLocation( rName ); glUniform4f( nUniform, - ((float) rColor.GetRed()) * nFactor / 25500.0, - ((float) rColor.GetGreen()) * nFactor / 25500.0, - ((float) rColor.GetBlue()) * nFactor / 25500.0, + static_cast<float>(rColor.GetRed()) * nFactor / 25500.0, + static_cast<float>(rColor.GetGreen()) * nFactor / 25500.0, + static_cast<float>(rColor.GetBlue()) * nFactor / 25500.0, 1.0f ); CHECK_GL_ERROR(); } @@ -317,10 +317,10 @@ void OpenGLProgram::SetTransform( const basegfx::B2DVector aXRel = rX - rNull; const basegfx::B2DVector aYRel = rY - rNull; const float aValues[] = { - (float) aXRel.getX()/nTexWidth, (float) aXRel.getY()/nTexWidth, 0, 0, - (float) aYRel.getX()/nTexHeight, (float) aYRel.getY()/nTexHeight, 0, 0, + static_cast<float>(aXRel.getX())/nTexWidth, static_cast<float>(aXRel.getY())/nTexWidth, 0, 0, + static_cast<float>(aYRel.getX())/nTexHeight, static_cast<float>(aYRel.getY())/nTexHeight, 0, 0, 0, 0, 1, 0, - (float) rNull.getX(), (float) rNull.getY(), 0, 1 }; + static_cast<float>(rNull.getX()), static_cast<float>(rNull.getY()), 0, 1 }; glm::mat4 aMatrix = glm::make_mat4( aValues ); glUniformMatrix4fv( nUniform, 1, GL_FALSE, glm::value_ptr( aMatrix ) ); CHECK_GL_ERROR(); diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx index 4ff79b65717b..7981a59ef89d 100644 --- a/vcl/opengl/scale.cxx +++ b/vcl/opengl/scale.cxx @@ -140,7 +140,7 @@ bool OpenGLSalBitmap::ImplScaleConvolution( for( sal_uInt32 i = 0; i < 16; i++ ) { - aOffsets[i * 2] = i / (double) mnWidth; + aOffsets[i * 2] = i / static_cast<double>(mnWidth); aOffsets[i * 2 + 1] = 0; } ImplCreateKernel( rScaleX, aKernel, pWeights, nKernelSize ); @@ -164,7 +164,7 @@ bool OpenGLSalBitmap::ImplScaleConvolution( for( sal_uInt32 i = 0; i < 16; i++ ) { aOffsets[i * 2] = 0; - aOffsets[i * 2 + 1] = i / (double) mnHeight; + aOffsets[i * 2 + 1] = i / static_cast<double>(mnHeight); } ImplCreateKernel( rScaleY, aKernel, pWeights, nKernelSize ); pProgram->SetUniform1fv( "kernel", 16, pWeights ); diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 86315b48a4b6..615b7c6d9db8 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -365,18 +365,18 @@ void OpenGLTexture::GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool b return; } - pCoord[0] = pCoord[2] = (maRect.Left() + rPosAry.mnSrcX) / (double) mpImpl->mnWidth; - pCoord[4] = pCoord[6] = (maRect.Left() + rPosAry.mnSrcX + rPosAry.mnSrcWidth) / (double) mpImpl->mnWidth; + pCoord[0] = pCoord[2] = (maRect.Left() + rPosAry.mnSrcX) / static_cast<double>(mpImpl->mnWidth); + pCoord[4] = pCoord[6] = (maRect.Left() + rPosAry.mnSrcX + rPosAry.mnSrcWidth) / static_cast<double>(mpImpl->mnWidth); if( !bInverted ) { - pCoord[3] = pCoord[5] = 1.0f - (maRect.Top() + rPosAry.mnSrcY) / (double) mpImpl->mnHeight; - pCoord[1] = pCoord[7] = 1.0f - (maRect.Top() + rPosAry.mnSrcY + rPosAry.mnSrcHeight) / (double) mpImpl->mnHeight; + pCoord[3] = pCoord[5] = 1.0f - (maRect.Top() + rPosAry.mnSrcY) / static_cast<double>(mpImpl->mnHeight); + pCoord[1] = pCoord[7] = 1.0f - (maRect.Top() + rPosAry.mnSrcY + rPosAry.mnSrcHeight) / static_cast<double>(mpImpl->mnHeight); } else { - pCoord[1] = pCoord[7] = 1.0f - (maRect.Top() + rPosAry.mnSrcY) / (double) mpImpl->mnHeight; - pCoord[3] = pCoord[5] = 1.0f - (maRect.Top() + rPosAry.mnSrcY + rPosAry.mnSrcHeight) / (double) mpImpl->mnHeight; + pCoord[1] = pCoord[7] = 1.0f - (maRect.Top() + rPosAry.mnSrcY) / static_cast<double>(mpImpl->mnHeight); + pCoord[3] = pCoord[5] = 1.0f - (maRect.Top() + rPosAry.mnSrcY + rPosAry.mnSrcHeight) / static_cast<double>(mpImpl->mnHeight); } } @@ -441,10 +441,10 @@ void OpenGLTexture::GetWholeCoord( GLfloat* pCoord ) const { if( GetWidth() != mpImpl->mnWidth || GetHeight() != mpImpl->mnHeight ) { - pCoord[0] = pCoord[2] = maRect.Left() / (double) mpImpl->mnWidth; - pCoord[4] = pCoord[6] = maRect.Right() / (double) mpImpl->mnWidth; - pCoord[3] = pCoord[5] = 1.0f - maRect.Top() / (double) mpImpl->mnHeight; - pCoord[1] = pCoord[7] = 1.0f - maRect.Bottom() / (double) mpImpl->mnHeight; + pCoord[0] = pCoord[2] = maRect.Left() / static_cast<double>(mpImpl->mnWidth); + pCoord[4] = pCoord[6] = maRect.Right() / static_cast<double>(mpImpl->mnWidth); + pCoord[3] = pCoord[5] = 1.0f - maRect.Top() / static_cast<double>(mpImpl->mnHeight); + pCoord[1] = pCoord[7] = 1.0f - maRect.Bottom() / static_cast<double>(mpImpl->mnHeight); } else { |