diff options
Diffstat (limited to 'vcl/qa/cppunit')
-rw-r--r-- | vcl/qa/cppunit/canvasbitmaptest.cxx | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index 070b8b6217a4..cf7a82c653ad 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -482,15 +482,13 @@ private: virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) override { const uno::Sequence< rendering::ARGBColor > aTemp( convertIntegerToARGB(deviceColor) ); - const std::size_t nLen(aTemp.getLength()); - uno::Sequence< rendering::RGBColor > aRes( nLen ); - rendering::RGBColor* pOut = aRes.getArray(); - for( std::size_t i=0; i<nLen; ++i ) - { - *pOut++ = rendering::RGBColor(aTemp[i].Red, - aTemp[i].Green, - aTemp[i].Blue); - } + uno::Sequence< rendering::RGBColor > aRes( aTemp.getLength() ); + std::transform(aTemp.begin(), aTemp.end(), aRes.begin(), + [](const rendering::ARGBColor& rColor) { + return rendering::RGBColor(rColor.Red, + rColor.Green, + rColor.Blue); + }); return aRes; } @@ -503,21 +501,18 @@ private: 0, static_cast<int>(nLen%nBytesPerPixel)); uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel ); - rendering::ARGBColor* pOut( aRes.getArray() ); if( getPalette().is() ) { - for( std::size_t i=0; i<nLen; ++i ) - { - *pOut++ = rendering::ARGBColor( - 1.0, - vcl::unotools::toDoubleColor(deviceColor[i]), - vcl::unotools::toDoubleColor(deviceColor[i]), - vcl::unotools::toDoubleColor(deviceColor[i])); - } + std::transform(deviceColor.begin(), deviceColor.end(), aRes.begin(), + [](sal_Int8 nIn) { + auto fColor = vcl::unotools::toDoubleColor(nIn); + return rendering::ARGBColor(1.0, fColor, fColor, fColor); + }); } else { + rendering::ARGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { *pOut++ = rendering::ARGBColor( @@ -540,21 +535,18 @@ private: 0, static_cast<int>(nLen%nBytesPerPixel)); uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel ); - rendering::ARGBColor* pOut( aRes.getArray() ); if( getPalette().is() ) { - for( std::size_t i=0; i<nLen; ++i ) - { - *pOut++ = rendering::ARGBColor( - 1.0, - vcl::unotools::toDoubleColor(deviceColor[i]), - vcl::unotools::toDoubleColor(deviceColor[i]), - vcl::unotools::toDoubleColor(deviceColor[i])); - } + std::transform(deviceColor.begin(), deviceColor.end(), aRes.begin(), + [](sal_Int8 nIn) { + auto fColor = vcl::unotools::toDoubleColor(nIn); + return rendering::ARGBColor(1.0, fColor, fColor, fColor); + }); } else { + rendering::ARGBColor* pOut( aRes.getArray() ); for( std::size_t i=0; i<nLen; i+=4 ) { const double fAlpha=vcl::unotools::toDoubleColor(deviceColor[i+3]); |