summaryrefslogtreecommitdiff
path: root/canvas/source/vcl
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/source/vcl
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/source/vcl')
-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
5 files changed, 23 insertions, 23 deletions
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