diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-08-21 21:51:09 -0400 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2015-08-24 21:20:13 +0000 |
commit | ead5bc3cfb07a4e96e367e7904dc674ee5f5ccd6 (patch) | |
tree | 46abe4e85efecb06058063290b14efeba08c1762 /slideshow/source/engine/slide/slideimpl.cxx | |
parent | 0a76c1fd6875bd094ebe2bfbed3d01c98dc0c19e (diff) |
slideshow: replace for_each with range-based loop
Replace ::std::for_each for a more readable range-based for loop in
cases in which the function object to be applied by for_each is more
readable as the body of a for loop.
Change-Id: Ib0b488b36ed58c65c56357e04391b85096d043aa
Reviewed-on: https://gerrit.libreoffice.org/17930
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'slideshow/source/engine/slide/slideimpl.cxx')
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 81 |
1 files changed, 25 insertions, 56 deletions
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 0d26285a5aec..9a6e83c06dbf 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -61,8 +61,6 @@ #include "targetpropertiescreator.hxx" #include "tools.hxx" - -#include <boost/bind.hpp> #include <iterator> #include <algorithm> #include <functional> @@ -282,49 +280,6 @@ private: - - -class SlideRenderer -{ -public: - explicit SlideRenderer( SlideImpl& rSlide ) : - mrSlide( rSlide ) - { - } - - void operator()( const UnoViewSharedPtr& rView ) - { - // fully clear view content to background color - rView->clearAll(); - - SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rView ) ); - ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); - - const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() ); - const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); - - // setup a canvas with device coordinate space, the slide - // bitmap already has the correct dimension. - ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); - pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); - - // render at given output position - pBitmap->move( aOutPosPixel ); - - // clear clip (might have been changed, e.g. from comb - // transition) - pBitmap->clip( ::basegfx::B2DPolyPolygon() ); - pBitmap->draw( pDevicePixelCanvas ); - } - -private: - SlideImpl& mrSlide; -}; - - - - - SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage, const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages, const uno::Reference< animations::XAnimationNode >& xRootNode, @@ -388,11 +343,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mbPaintOverlayActive( false ) { // clone already existing views for slide bitmaps - std::for_each( rViewContainer.begin(), - rViewContainer.end(), - boost::bind( &SlideImpl::viewAdded, - this, - _1 )); + for( const auto& rView : rViewContainer ) + this->viewAdded( rView ); // register screen update (LayerManager needs to signal pending // updates) @@ -462,13 +414,30 @@ bool SlideImpl::show( bool bSlideBackgoundPainted ) // render slide to screen, if requested if( !bSlideBackgoundPainted ) { - std::for_each(maContext.mrViewContainer.begin(), - maContext.mrViewContainer.end(), - boost::mem_fn(&View::clearAll)); + for( const auto& rView : maContext.mrViewContainer ) { + // fully clear view content to background color + rView->clearAll(); + + SlideBitmapSharedPtr pBitmap( this->getCurrentSlideBitmap( rView ) ); + ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); + + const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() ); + const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); + + // setup a canvas with device coordinate space, the slide + // bitmap already has the correct dimension. + ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + + // render at given output position + pBitmap->move( aOutPosPixel ); + + // clear clip (might have been changed, e.g. from comb + // transition) + pBitmap->clip( ::basegfx::B2DPolyPolygon() ); + pBitmap->draw( pDevicePixelCanvas ); + } - std::for_each( maContext.mrViewContainer.begin(), - maContext.mrViewContainer.end(), - SlideRenderer(*this) ); maContext.mrScreenUpdater.notifyUpdate(); } |