summaryrefslogtreecommitdiff
path: root/canvas/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-06-29 17:08:11 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-06-29 22:25:18 +0200
commit458e3f67c038d405826eb831bfc0f2aed78f640e (patch)
tree37ab76ca09fe43651d9ad1de057e9e5369d85308 /canvas/source
parent14e625e0a0618cce5cefefb1527cd2dfdb61224e (diff)
Small refactor
Change-Id: I14021d3e0b83dcd4fb5544239e982c8ada32d029 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97429 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'canvas/source')
-rw-r--r--canvas/source/factory/cf_service.cxx24
1 files changed, 8 insertions, 16 deletions
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 936c99885f20..874b1ffe68bf 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -368,19 +368,15 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
}
const Sequence<OUString> aPreferredImpls( aAvailImplsMatch->second );
- const OUString* pCurrImpl = aPreferredImpls.getConstArray();
- const OUString* const pEndImpl = pCurrImpl + aPreferredImpls.getLength();
+ const OUString* pCurrImpl = aPreferredImpls.begin();
+ const OUString* const pEndImpl = aPreferredImpls.end();
const Sequence<OUString> aAAImpls( aAAImplsMatch->second );
- const OUString* const pFirstAAImpl = aAAImpls.getConstArray();
- const OUString* const pEndAAImpl = pFirstAAImpl + aAAImpls.getLength();
const Sequence<OUString> aAccelImpls( aAccelImplsMatch->second );
- const OUString* const pFirstAccelImpl = aAccelImpls.getConstArray();
- const OUString* const pEndAccelImpl = pFirstAccelImpl + aAccelImpls.getLength();
// force last entry from impl list, if config flag set
- if( bForceLastEntry )
+ if (bForceLastEntry && pCurrImpl != pEndImpl)
pCurrImpl = pEndImpl-1;
while( pCurrImpl != pEndImpl )
@@ -390,8 +386,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
// check whether given canvas service is listed in the
// sequence of "accelerated canvas implementations"
const bool bIsAcceleratedImpl(
- std::any_of(pFirstAccelImpl,
- pEndAccelImpl,
+ std::any_of(aAccelImpls.begin(), aAccelImpls.end(),
[&aCurrName](OUString const& src)
{ return aCurrName == src.trim(); }
));
@@ -399,8 +394,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
// check whether given canvas service is listed in the
// sequence of "antialiasing canvas implementations"
const bool bIsAAImpl(
- std::any_of(pFirstAAImpl,
- pEndAAImpl,
+ std::any_of(aAAImpls.begin(), aAAImpls.end(),
[&aCurrName](OUString const& src)
{ return aCurrName == src.trim(); }
));
@@ -413,8 +407,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
// http://en.wikipedia.org/wiki/Truth_table#Logical_implication
if( (!bIsAAImpl || bUseAAEntry) && (!bIsAcceleratedImpl || bUseAcceleratedEntry) )
{
- Reference<XInterface> xCanvas(
- use( pCurrImpl->trim(), args, xContext ) );
+ Reference<XInterface> xCanvas(use(aCurrName, args, xContext));
if(xCanvas.is())
{
@@ -422,13 +415,12 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
{
// cache entry exists, replace dysfunctional
// implementation name
- aMatch->second = pCurrImpl->trim();
+ aMatch->second = aCurrName;
}
else
{
// new service name, add new cache entry
- m_aCachedImplementations.emplace_back(serviceName,
- pCurrImpl->trim());
+ m_aCachedImplementations.emplace_back(serviceName, aCurrName);
}
return xCanvas;