diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-10-08 14:48:15 -0400 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-09 07:09:22 +0000 |
commit | 6e8f1a3bd1c9110fe0a1b7978991800377e2908e (patch) | |
tree | 59b35d7005763f9afdc46cc3ab0c90de404b0183 /slideshow/source/engine/slide/slideimpl.cxx | |
parent | f0e3fe840b6f103c589f044bbde18b2faa345279 (diff) |
slideshow: replace for_each with range-based for
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: I5798293cdd0d784cc4c95c67e3fc6a0b930db8bb
Reviewed-on: https://gerrit.libreoffice.org/19261
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'slideshow/source/engine/slide/slideimpl.cxx')
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 0d26285a5aec..4bb090b9e84a 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -64,7 +64,6 @@ #include <boost/bind.hpp> #include <iterator> -#include <algorithm> #include <functional> #include <iostream> @@ -284,42 +283,30 @@ private: -class SlideRenderer +void slideRenderer( SlideImpl* pSlide, const UnoViewSharedPtr& rView ) { -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() ); + // fully clear view content to background color + rView->clearAll(); - const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() ); - const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); + SlideBitmapSharedPtr pBitmap( pSlide->getCurrentSlideBitmap( rView ) ); + ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); - // setup a canvas with device coordinate space, the slide - // bitmap already has the correct dimension. - ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); - pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() ); + const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); - // render at given output position - pBitmap->move( aOutPosPixel ); + // setup a canvas with device coordinate space, the slide + // bitmap already has the correct dimension. + ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); - // clear clip (might have been changed, e.g. from comb - // transition) - pBitmap->clip( ::basegfx::B2DPolyPolygon() ); - pBitmap->draw( pDevicePixelCanvas ); - } + // render at given output position + pBitmap->move( aOutPosPixel ); -private: - SlideImpl& mrSlide; -}; + // clear clip (might have been changed, e.g. from comb + // transition) + pBitmap->clip( ::basegfx::B2DPolyPolygon() ); + pBitmap->draw( pDevicePixelCanvas ); +} @@ -388,11 +375,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 +446,9 @@ 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& rContext : maContext.mrViewContainer ) + slideRenderer( this, rContext ); - std::for_each( maContext.mrViewContainer.begin(), - maContext.mrViewContainer.end(), - SlideRenderer(*this) ); maContext.mrScreenUpdater.notifyUpdate(); } |