summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/opengl/TransitionerImpl.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-07-20 20:03:15 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-07-22 18:42:35 +0200
commit6ffdc88e79904882e319bdd0b901e7491abae0b3 (patch)
tree5cb0257a03987f962668655af536a05ad72f8882 /slideshow/source/engine/opengl/TransitionerImpl.cxx
parent803a6ccb774ff6dc67ca697459d6679e4bc9604f (diff)
Simplify Sequence iterations in shell..svgio
Use range-based loops, STL and comphelper functions Change-Id: I612d36abcc09a91c60f7212de6747a1a1bdcfc69 Reviewed-on: https://gerrit.libreoffice.org/76056 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'slideshow/source/engine/opengl/TransitionerImpl.cxx')
-rw-r--r--slideshow/source/engine/opengl/TransitionerImpl.cxx93
1 files changed, 37 insertions, 56 deletions
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index f66d1402ee24..2bec0badb196 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -550,52 +550,46 @@ private:
}
virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
{
- const rendering::RGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< double > aRes(nLen*4);
double* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::RGBColor& rIn : rgbColor )
{
- *pColors++ = pIn->Red;
- *pColors++ = pIn->Green;
- *pColors++ = pIn->Blue;
+ *pColors++ = rIn.Red;
+ *pColors++ = rIn.Green;
+ *pColors++ = rIn.Blue;
*pColors++ = 1.0;
- ++pIn;
}
return aRes;
}
virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
{
- const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< double > aRes(nLen*4);
double* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::ARGBColor& rIn : rgbColor )
{
- *pColors++ = pIn->Red;
- *pColors++ = pIn->Green;
- *pColors++ = pIn->Blue;
- *pColors++ = pIn->Alpha;
- ++pIn;
+ *pColors++ = rIn.Red;
+ *pColors++ = rIn.Green;
+ *pColors++ = rIn.Blue;
+ *pColors++ = rIn.Alpha;
}
return aRes;
}
virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
{
- const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< double > aRes(nLen*4);
double* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::ARGBColor& rIn : rgbColor )
{
- *pColors++ = pIn->Red/pIn->Alpha;
- *pColors++ = pIn->Green/pIn->Alpha;
- *pColors++ = pIn->Blue/pIn->Alpha;
- *pColors++ = pIn->Alpha;
- ++pIn;
+ *pColors++ = rIn.Red/rIn.Alpha;
+ *pColors++ = rIn.Green/rIn.Alpha;
+ *pColors++ = rIn.Blue/rIn.Alpha;
+ *pColors++ = rIn.Alpha;
}
return aRes;
}
@@ -618,21 +612,14 @@ private:
{
if( dynamic_cast<OGLColorSpace*>(targetColorSpace.get()) )
{
- const sal_Int8* pIn( deviceColor.getConstArray() );
- const std::size_t nLen( deviceColor.getLength() );
+ const sal_Int32 nLen( deviceColor.getLength() );
ENSURE_ARG_OR_THROW2(nLen%4==0,
"number of channels no multiple of 4",
static_cast<rendering::XColorSpace*>(this), 0);
uno::Sequence<double> aRes(nLen);
- double* pOut( aRes.getArray() );
- for( std::size_t i=0; i<nLen; i+=4 )
- {
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
- }
+ std::transform(deviceColor.begin(), deviceColor.end(), aRes.begin(),
+ vcl::unotools::toDoubleColor);
return aRes;
}
else
@@ -729,54 +716,48 @@ private:
virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override
{
- const rendering::RGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< sal_Int8 > aRes(nLen*4);
sal_Int8* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::RGBColor& rIn : rgbColor )
{
- *pColors++ = vcl::unotools::toByteColor(pIn->Red);
- *pColors++ = vcl::unotools::toByteColor(pIn->Green);
- *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Red);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Green);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Blue);
*pColors++ = -1;
- ++pIn;
}
return aRes;
}
virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
{
- const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< sal_Int8 > aRes(nLen*4);
sal_Int8* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::ARGBColor& rIn : rgbColor )
{
- *pColors++ = vcl::unotools::toByteColor(pIn->Red);
- *pColors++ = vcl::unotools::toByteColor(pIn->Green);
- *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
- *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
- ++pIn;
+ *pColors++ = vcl::unotools::toByteColor(rIn.Red);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Green);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Blue);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Alpha);
}
return aRes;
}
virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override
{
- const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
- const std::size_t nLen( rgbColor.getLength() );
+ const sal_Int32 nLen( rgbColor.getLength() );
uno::Sequence< sal_Int8 > aRes(nLen*4);
sal_Int8* pColors=aRes.getArray();
- for( std::size_t i=0; i<nLen; ++i )
+ for( const rendering::ARGBColor& rIn : rgbColor )
{
- *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
- *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
- *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
- *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
- ++pIn;
+ *pColors++ = vcl::unotools::toByteColor(rIn.Red/rIn.Alpha);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Green/rIn.Alpha);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Blue/rIn.Alpha);
+ *pColors++ = vcl::unotools::toByteColor(rIn.Alpha);
}
return aRes;
}