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
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace canvas
|
||||
// XBufferController
|
||||
virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) override
|
||||
{
|
||||
tools::verifyRange( nBuffers, (sal_Int32)1 );
|
||||
tools::verifyRange( nBuffers, sal_Int32(1) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user