[Libreoffice-commits] core.git: basegfx/source canvas/source

Takeshi Abe tabe at fixedpoint.jp
Thu May 7 07:04:09 PDT 2015


 basegfx/source/range/b2dpolyrange.cxx       |    4 ++--
 canvas/source/factory/cf_service.cxx        |    8 ++++----
 canvas/source/tools/spriteredrawmanager.cxx |    8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 5a7c1bc635c7e0377bb743d91b0cf385397b7337
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon May 4 09:33:59 2015 +0900

    simplify code by replacing std::find_if with std::any_of/std::none_of
    
    Change-Id: Ife6ab3544f73b1de60f5241c68466045161a4d88
    Reviewed-on: https://gerrit.libreoffice.org/15615
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx
index 3722ca4..3aec84d 100644
--- a/basegfx/source/range/b2dpolyrange.cxx
+++ b/basegfx/source/range/b2dpolyrange.cxx
@@ -80,11 +80,11 @@ namespace basegfx
                 return false;
 
             const std::vector<B2DRange>::const_iterator aEnd( maRanges.end() );
-            return std::find_if( maRanges.begin(),
+            return std::any_of( maRanges.begin(),
                                  aEnd,
                                  boost::bind<bool>( boost::mem_fn( &B2DRange::overlaps ),
                                                     _1,
-                                                    boost::cref(rRange) ) ) != aEnd;
+                                                    boost::cref(rRange) ) );
         }
 
         B2DPolyPolygon solveCrossovers() const
diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx
index 3f3c24e..427acb7 100644
--- a/canvas/source/factory/cf_service.cxx
+++ b/canvas/source/factory/cf_service.cxx
@@ -401,24 +401,24 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
         // check whether given canvas service is listed in the
         // sequence of "accelerated canvas implementations"
         const bool bIsAcceleratedImpl(
-            std::find_if(pFirstAccelImpl,
+            std::any_of(pFirstAccelImpl,
                          pEndAccelImpl,
                          boost::bind(&OUString::equals,
                                      boost::cref(aCurrName),
                                      boost::bind(
                                          &OUString::trim,
-                                         _1))) != pEndAccelImpl );
+                                         _1))) );
 
         // check whether given canvas service is listed in the
         // sequence of "antialiasing canvas implementations"
         const bool bIsAAImpl(
-            std::find_if(pFirstAAImpl,
+            std::any_of(pFirstAAImpl,
                          pEndAAImpl,
                          boost::bind(&OUString::equals,
                                      boost::cref(aCurrName),
                                      boost::bind(
                                          &OUString::trim,
-                                         _1))) != pEndAAImpl );
+                                         _1))) );
 
         // try to instantiate canvas *only* if either accel and AA
         // property match preference, *or*, if there's a mismatch, only
diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx
index 7873883..a98a65e 100644
--- a/canvas/source/tools/spriteredrawmanager.cxx
+++ b/canvas/source/tools/spriteredrawmanager.cxx
@@ -423,12 +423,12 @@ namespace canvas
 
         // and check whether _any_ of the sprites tells that its area
         // update will not be opaque.
-        return (::std::find_if( rUpdateArea.maComponentList.begin(),
+        return ::std::none_of( rUpdateArea.maComponentList.begin(),
                                 aEnd,
                                 ::boost::bind( &SpriteRedrawManager::isAreaUpdateNotOpaque,
                                                this,
                                                ::boost::cref(aTrueArea),
-                                               _1 ) ) == aEnd );
+                                               _1 ) );
     }
 
     bool SpriteRedrawManager::areSpritesChanged( const UpdateArea& rUpdateArea ) const
@@ -440,12 +440,12 @@ namespace canvas
         // component (return false)
         const SpriteConnectedRanges::ComponentListType::const_iterator aEnd(
             rUpdateArea.maComponentList.end() );
-        return (::std::find_if( rUpdateArea.maComponentList.begin(),
+        return ::std::any_of( rUpdateArea.maComponentList.begin(),
                                 aEnd,
                                 ::boost::bind( &SpriteInfo::needsUpdate,
                                                ::boost::bind(
                                                    ::o3tl::select2nd<SpriteConnectedRanges::ComponentType>(),
-                                                   _1 ) ) ) != aEnd );
+                                                   _1 ) ) );
     }
 
     SpriteRedrawManager::SpriteRedrawManager() :


More information about the Libreoffice-commits mailing list