summaryrefslogtreecommitdiff
path: root/slideshow
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
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')
-rw-r--r--slideshow/source/engine/activities/activitiesfactory.cxx4
-rw-r--r--slideshow/source/engine/opengl/TransitionerImpl.cxx93
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx7
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx16
-rw-r--r--slideshow/source/engine/tools.cxx6
5 files changed, 50 insertions, 76 deletions
diff --git a/slideshow/source/engine/activities/activitiesfactory.cxx b/slideshow/source/engine/activities/activitiesfactory.cxx
index ba75b46eb5a1..e2cc9987e998 100644
--- a/slideshow/source/engine/activities/activitiesfactory.cxx
+++ b/slideshow/source/engine/activities/activitiesfactory.cxx
@@ -621,11 +621,11 @@ AnimationActivitySharedPtr createValueListActivity(
ValueVectorType aValueVector;
aValueVector.reserve( rValues.getLength() );
- for( ::std::size_t i=0, nLen=rValues.getLength(); i<nLen; ++i )
+ for( const auto& rValue : rValues )
{
ValueType aValue;
ENSURE_OR_THROW(
- extractValue( aValue, rValues[i], rShape, rSlideBounds ),
+ extractValue( aValue, rValue, rShape, rSlideBounds ),
"createValueListActivity(): Could not extract values" );
aValueVector.push_back( aValue );
}
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;
}
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 619da5d4af1c..2b2139ab63b8 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -398,14 +398,13 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP
getPropertyValue( fLineWidth, xPropSet, "LineWidth" );
drawing::PointSequence* pOuterSequence = aRetval.getArray();
- awt::Point* pInnerSequence = pOuterSequence->getArray();
::basegfx::B2DPolygon aPoly;
basegfx::B2DPoint aPoint;
- for( sal_Int32 nCurrPoly=0; nCurrPoly<pOuterSequence->getLength(); ++nCurrPoly, ++pInnerSequence )
+ for( const awt::Point& rPoint : *pOuterSequence )
{
- aPoint.setX((*pInnerSequence).X);
- aPoint.setY((*pInnerSequence).Y);
+ aPoint.setX(rPoint.X);
+ aPoint.setY(rPoint.Y);
aPoly.append( aPoint );
}
for( const auto& pView : mrContext.mrViewContainer )
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 13b1181f48c9..3786a00786c2 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -845,11 +845,10 @@ void SlideImpl::applyShapeAttributes(
TargetPropertiesCreator::createTargetProperties( xRootAnimationNode, bInitial ) );
// apply extracted values to our shapes
- const ::std::size_t nSize( aProps.getLength() );
- for( ::std::size_t i=0; i<nSize; ++i )
+ for( const auto& rProp : aProps )
{
sal_Int16 nParaIndex( -1 );
- uno::Reference< drawing::XShape > xShape( aProps[i].Target,
+ uno::Reference< drawing::XShape > xShape( rProp.Target,
uno::UNO_QUERY );
if( !xShape.is() )
@@ -857,7 +856,7 @@ void SlideImpl::applyShapeAttributes(
// not a shape target. Maybe a ParagraphTarget?
presentation::ParagraphTarget aParaTarget;
- if( aProps[i].Target >>= aParaTarget )
+ if( rProp.Target >>= aParaTarget )
{
// yep, ParagraphTarget found - extract shape
// and index
@@ -913,14 +912,13 @@ void SlideImpl::applyShapeAttributes(
}
}
- const uno::Sequence< beans::NamedValue >& rShapeProps( aProps[i].Properties );
- const ::std::size_t nShapePropSize( rShapeProps.getLength() );
- for( ::std::size_t j=0; j<nShapePropSize; ++j )
+ const uno::Sequence< beans::NamedValue >& rShapeProps( rProp.Properties );
+ for( const auto& rShapeProp : rShapeProps )
{
bool bVisible=false;
- if( rShapeProps[j].Name.equalsIgnoreAsciiCase("visibility") &&
+ if( rShapeProp.Name.equalsIgnoreAsciiCase("visibility") &&
extractValue( bVisible,
- rShapeProps[j].Value,
+ rShapeProp.Value,
pShape,
::basegfx::B2DSize( getSlideSize() ) ))
{
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 089f473f69ac..096715a73c90 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -432,11 +432,7 @@ namespace slideshow
bool findNamedValue( uno::Sequence< beans::NamedValue > const& rSequence,
const beans::NamedValue& rSearchKey )
{
- const beans::NamedValue* pArray = rSequence.getConstArray();
- const size_t nLen( rSequence.getLength() );
-
- return ::std::any_of( pArray,
- pArray + nLen,
+ return ::std::any_of( rSequence.begin(), rSequence.end(),
NamedValueComparator( rSearchKey ) );
}