summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:28:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:28:43 +0100
commit5ff52393f9082c82e8083fbdbb2bd899b443ea15 (patch)
tree3ad251eab83cf45e311074148c144d916eb345e4 /canvas
parent898a8b00622d219741ec7649dbac560bc1f70f6b (diff)
More loplugin:cstylecast: canvas
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: I1054389bc292544a1ba302509175c8718dbec747
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_canvasbitmap.cxx10
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx4
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx4
-rw-r--r--canvas/source/opengl/ogl_spritedevicehelper.cxx4
-rw-r--r--canvas/source/vcl/canvasbitmap.cxx2
-rw-r--r--canvas/source/vcl/canvasbitmaphelper.cxx8
-rw-r--r--canvas/source/vcl/canvashelper.cxx8
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx26
-rw-r--r--canvas/source/vcl/spritehelper.cxx2
9 files changed, 34 insertions, 34 deletions
diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index d3cdef800e9f..7894e2e978e2 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -147,10 +147,10 @@ namespace cairocanvas
cairo_surface_flush(pPixels);
unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
unsigned int nStride = cairo_image_surface_get_stride( pPixels );
- for( unsigned long y = 0; y < (unsigned long) aSize.Height(); y++ )
+ for( unsigned long y = 0; y < static_cast<unsigned long>(aSize.Height()); y++ )
{
sal_uInt32 *pPix = reinterpret_cast<sal_uInt32 *>(pSrc + nStride * y);
- for( unsigned long x = 0; x < (unsigned long) aSize.Width(); x++ )
+ for( unsigned long x = 0; x < static_cast<unsigned long>(aSize.Width()); x++ )
{
#if defined OSL_BIGENDIAN
sal_uInt8 nB = (*pPix >> 24);
@@ -166,9 +166,9 @@ namespace cairocanvas
if( nAlpha != 0 && nAlpha != 255 )
{
// Cairo uses pre-multiplied alpha - we do not => re-multiply
- nR = (sal_uInt8) MinMax( ((sal_uInt32)nR * 255) / nAlpha, 0, 255 );
- nG = (sal_uInt8) MinMax( ((sal_uInt32)nG * 255) / nAlpha, 0, 255 );
- nB = (sal_uInt8) MinMax( ((sal_uInt32)nB * 255) / nAlpha, 0, 255 );
+ nR = static_cast<sal_uInt8>(MinMax( (static_cast<sal_uInt32>(nR) * 255) / nAlpha, 0, 255 ));
+ nG = static_cast<sal_uInt8>(MinMax( (static_cast<sal_uInt32>(nG) * 255) / nAlpha, 0, 255 ));
+ nB = static_cast<sal_uInt8>(MinMax( (static_cast<sal_uInt32>(nB) * 255) / nAlpha, 0, 255 ));
}
pRGBWrite->SetPixel( y, x, BitmapColor( nR, nG, nB ) );
pMaskWrite->SetPixelIndex( y, x, 255 - nAlpha );
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 74b612928ffd..622985f11b5c 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -1817,7 +1817,7 @@ namespace cairocanvas
rendering::RGBColor* pOut( aRes.getArray() );
for( std::size_t i=0; i<nLen; i+=4 )
{
- const double fAlpha((sal_uInt8)pIn[3]);
+ const double fAlpha(static_cast<sal_uInt8>(pIn[3]));
if( fAlpha )
*pOut++ = rendering::RGBColor(
pIn[2]/fAlpha,
@@ -1842,7 +1842,7 @@ namespace cairocanvas
rendering::ARGBColor* pOut( aRes.getArray() );
for( std::size_t i=0; i<nLen; i+=4 )
{
- const double fAlpha((sal_uInt8)pIn[3]);
+ const double fAlpha(static_cast<sal_uInt8>(pIn[3]));
if( fAlpha )
*pOut++ = rendering::ARGBColor(
fAlpha/255.0,
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index bac25404379b..5fb4db08dd2e 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -485,7 +485,7 @@ namespace cairocanvas
if (rSysFontData.bFakeBold)
{
double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetFontHeight() );
- int total_steps = 1 * ((int) (bold_dx + 0.5));
+ int total_steps = 1 * static_cast<int>(bold_dx + 0.5);
// loop to draw the text for every half pixel of displacement
for (int nSteps = 0; nSteps < total_steps; nSteps++)
@@ -497,7 +497,7 @@ namespace cairocanvas
}
cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
}
- SAL_INFO("canvas.cairo",":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:" << (int) bold_dx);
+ SAL_INFO("canvas.cairo",":cairocanvas::TextLayout::draw(S,O,p,v,r): FAKEBOLD - dx:" << static_cast<int>(bold_dx));
}
cairo_font_face_destroy(font_face);
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index 3f4c8a7414b5..3043deeaec3f 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -56,8 +56,8 @@ static void initTransformation(const ::Size& rSize)
{
// use whole window
glViewport( 0,0,
- (GLsizei)rSize.Width(),
- (GLsizei)rSize.Height() );
+ static_cast<GLsizei>(rSize.Width()),
+ static_cast<GLsizei>(rSize.Height()) );
// model coordinate system is already in device pixel
glMatrixMode(GL_MODELVIEW);
diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx
index 9126fc5c0666..638d71764856 100644
--- a/canvas/source/vcl/canvasbitmap.cxx
+++ b/canvas/source/vcl/canvasbitmap.cxx
@@ -41,7 +41,7 @@ namespace vclcanvas
{
// create bitmap for given reference device
// ========================================
- const sal_uInt16 nBitCount( (sal_uInt16)24U );
+ const sal_uInt16 nBitCount( sal_uInt16(24U) );
const BitmapPalette* pPalette = nullptr;
Bitmap aBitmap( rSize, nBitCount, pPalette );
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx
index f7af9d1182d3..f3f3995a889b 100644
--- a/canvas/source/vcl/canvasbitmaphelper.cxx
+++ b/canvas/source/vcl/canvasbitmaphelper.cxx
@@ -248,10 +248,10 @@ namespace vclcanvas
x<aBmpSize.Width() && x<rect.X2;
++x )
{
- *pScan++ = (sal_uInt8)pWriteAccess->GetBestPaletteIndex(
+ *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex(
BitmapColor( data[ nCurrPos ],
data[ nCurrPos+1 ],
- data[ nCurrPos+2 ] ) );
+ data[ nCurrPos+2 ] ) ));
nCurrPos += 3;
@@ -341,10 +341,10 @@ namespace vclcanvas
x<aBmpSize.Width() && x<rect.X2;
++x )
{
- *pScan++ = (sal_uInt8)pWriteAccess->GetBestPaletteIndex(
+ *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex(
BitmapColor( data[ nCurrPos ],
data[ nCurrPos+1 ],
- data[ nCurrPos+2 ] ) );
+ data[ nCurrPos+2 ] ) ));
nCurrPos += 4; // skip three colors, _plus_ alpha
}
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 55c2c1cd4137..f75f6344c575 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -522,7 +522,7 @@ namespace vclcanvas
else
{
const int nTransPercent( (nTransparency * 100 + 128) / 255 ); // normal rounding, no truncation here
- mpOutDev->getOutDev().DrawTransparent( aPolyPoly, (sal_uInt16)nTransPercent );
+ mpOutDev->getOutDev().DrawTransparent( aPolyPoly, static_cast<sal_uInt16>(nTransPercent) );
}
if( mp2ndOutDev )
@@ -1008,7 +1008,7 @@ namespace vclcanvas
rOutDev.SetAntialiasing( AntialiasingFlags::EnableB2dDraw );
const ::tools::Rectangle aRect( vcl::unotools::rectangleFromIntegerRectangle2D(rect) );
- const sal_uInt16 nBitCount( std::min( (sal_uInt16)24, rOutDev.GetBitCount() ) );
+ const sal_uInt16 nBitCount( std::min( sal_uInt16(24), rOutDev.GetBitCount() ) );
const BitmapPalette* pPalette = nullptr;
if( nBitCount <= 8 )
@@ -1052,10 +1052,10 @@ namespace vclcanvas
for( x=0; x<nWidth; ++x )
{
- *pScan++ = (sal_uInt8)pWriteAccess->GetBestPaletteIndex(
+ *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex(
BitmapColor( data[ nCurrPos ],
data[ nCurrPos+1 ],
- data[ nCurrPos+2 ] ) );
+ data[ nCurrPos+2 ] ) ));
nCurrPos += 4;
}
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 7df0c9831c11..9d7aaa502a88 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -208,9 +208,9 @@ namespace vclcanvas
std::tie(nIndex,fAlpha)=aLerper.lerp(double(i)/nStepCount);
rOutDev.SetFillColor(
- Color( (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
+ Color( static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
// copy right edge of polygon to left edge (and also
// copy the closing point)
@@ -375,9 +375,9 @@ namespace vclcanvas
// lerp color
rOutDev.SetFillColor(
- Color( (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
+ Color( static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
// scale and render polygon, by interpolating between
// outer and inner polygon.
@@ -387,13 +387,13 @@ namespace vclcanvas
const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
- aTempPoly[(sal_uInt16)p] = ::Point(
+ aTempPoly[static_cast<sal_uInt16>(p)] = ::Point(
basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
}
// close polygon explicitly
- aTempPoly[(sal_uInt16)p] = aTempPoly[0];
+ aTempPoly[static_cast<sal_uInt16>(p)] = aTempPoly[0];
// TODO(P1): compare with vcl/source/gdi/outdev4.cxx,
// OutputDevice::ImplDrawComplexGradient(), there's a note
@@ -433,9 +433,9 @@ namespace vclcanvas
// lerp color
rOutDev.SetFillColor(
- Color( (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
- (sal_uInt8)(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
+ Color( static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha)),
+ static_cast<sal_uInt8>(basegfx::utils::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha)) ));
#if OSL_DEBUG_LEVEL > 0
if( i && !(i % 10) )
@@ -451,13 +451,13 @@ namespace vclcanvas
const ::basegfx::B2DPoint& rOuterPoint( aOuterPoly.getB2DPoint(p) );
const ::basegfx::B2DPoint& rInnerPoint( aInnerPoly.getB2DPoint(p) );
- aTempPoly[(sal_uInt16)p] = ::Point(
+ aTempPoly[static_cast<sal_uInt16>(p)] = ::Point(
basegfx::fround( fT*rInnerPoint.getX() + (1-fT)*rOuterPoint.getX() ),
basegfx::fround( fT*rInnerPoint.getY() + (1-fT)*rOuterPoint.getY() ) );
}
// close polygon explicitly
- aTempPoly[(sal_uInt16)p] = aTempPoly[0];
+ aTempPoly[static_cast<sal_uInt16>(p)] = aTempPoly[0];
// swap inner and outer polygon
aTempPolyPoly.Replace( aTempPolyPoly.GetObject( 1 ), 0 );
diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx
index 2aa1d99bbebe..6be7dd8c258f 100644
--- a/canvas/source/vcl/spritehelper.cxx
+++ b/canvas/source/vcl/spritehelper.cxx
@@ -301,7 +301,7 @@ namespace vclcanvas
for( int i=0; i<aMarkerPoly.Count(); ++i )
{
- rTargetSurface.DrawPolyLine( aMarkerPoly.GetObject((sal_uInt16)i) );
+ rTargetSurface.DrawPolyLine( aMarkerPoly.GetObject(static_cast<sal_uInt16>(i)) );
}
// paint sprite prio