diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-10-08 15:35:06 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-10-08 15:35:47 +0200 |
commit | 862bd364390a05ad0b07f9280fb9a0f8b2cc4ed6 (patch) | |
tree | b2e86b04abc1cb675eb17ff09bbfbf8a453bb3a8 /slideshow/source/engine/slide/slideimpl.cxx | |
parent | bd0e0dc7bdf0b4e027a93ff0db330472e0b90897 (diff) |
tdf#94222: Revert "slideshow: replace for_each with range-based loop"
This reverts commit ead5bc3cfb07a4e96e367e7904dc674ee5f5ccd6.
Change-Id: Icc2778cf904a71c4deaff4575d0de231acfc1335
Diffstat (limited to 'slideshow/source/engine/slide/slideimpl.cxx')
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 81 |
1 files changed, 56 insertions, 25 deletions
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 9a6e83c06dbf..0d26285a5aec 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -61,6 +61,8 @@ #include "targetpropertiescreator.hxx" #include "tools.hxx" + +#include <boost/bind.hpp> #include <iterator> #include <algorithm> #include <functional> @@ -280,6 +282,49 @@ 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, @@ -343,8 +388,11 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mbPaintOverlayActive( false ) { // clone already existing views for slide bitmaps - for( const auto& rView : rViewContainer ) - this->viewAdded( rView ); + std::for_each( rViewContainer.begin(), + rViewContainer.end(), + boost::bind( &SlideImpl::viewAdded, + this, + _1 )); // register screen update (LayerManager needs to signal pending // updates) @@ -414,30 +462,13 @@ bool SlideImpl::show( bool bSlideBackgoundPainted ) // render slide to screen, if requested if( !bSlideBackgoundPainted ) { - 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(), + boost::mem_fn(&View::clearAll)); + std::for_each( maContext.mrViewContainer.begin(), + maContext.mrViewContainer.end(), + SlideRenderer(*this) ); maContext.mrScreenUpdater.notifyUpdate(); } |