22#include <boost/cast.hpp>
40 void repaintBackground( const ::basegfx::B2DRange& rUpdateArea,
41 const ::basegfx::B2IRange& rOutputArea,
46 static_cast<sal_Int32
>(rOutputArea.getWidth()),
47 static_cast<sal_Int32
>(rOutputArea.getHeight()) );
48 aActualArea.intersect(
fround( rUpdateArea ) );
51 rBackBuffer->draw(aActualArea);
54 void spriteRedraw( const ::canvas::Sprite::Reference& rSprite )
58 ::boost::polymorphic_downcast< Sprite* >(
59 rSprite.get() )->redraw();
64 mpSpriteSurface( nullptr ),
65 mpRedrawManager( nullptr ),
71 mbShowSpriteBounds( false )
73#if OSL_DEBUG_LEVEL > 0
82 const std::shared_ptr<canvas::ISurfaceProxyManager>& rSurfaceProxy,
84 const ::basegfx::B2ISize& rOutputOffset )
112 const uno::Reference< rendering::XAnimation >& )
114 return uno::Reference< rendering::XAnimatedSprite >();
118 const uno::Sequence< uno::Reference< rendering::XBitmap > >& ,
121 return uno::Reference< rendering::XAnimatedSprite >();
127 return uno::Reference< rendering::XCustomSprite >();
129 return uno::Reference< rendering::XCustomSprite >(
130 new CanvasCustomSprite( spriteSize,
139 return uno::Reference< rendering::XSprite >();
144 bool& io_bSurfaceDirty )
167 if( !bUpdateAll && !io_bSurfaceDirty )
187 const ::basegfx::B2IRectangle aUpdateArea( 0,0,
188 static_cast<sal_Int32
>(rCurrArea.getWidth()),
189 static_cast<sal_Int32
>(rCurrArea.getHeight()) );
214 io_bSurfaceDirty =
false;
223 "SpriteCanvasHelper::backgroundPaint(): NULL device pointer " );
225 repaintBackground( rUpdateRect,
231 const ::basegfx::B2DRange& rMoveEnd,
232 const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea )
236 "SpriteCanvasHelper::scrollUpdate(): NULL device pointer " );
243 const ::basegfx::B2IRange& rDestRect(
253 for(
const auto& rComponent : rUpdateArea.maComponentList )
255 const ::canvas::Sprite::Reference& rSprite( rComponent.second.getSprite() );
261 ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw();
268 std::vector< ::basegfx::B2DRange > aUncoveredAreas;
269 ::basegfx::computeSetDifference( aUncoveredAreas,
270 rUpdateArea.maTotalBounds,
272 for(
const auto& rUncoveredArea : aUncoveredAreas )
286 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
290 "SpriteCanvasHelper::opaqueUpdate(): NULL device pointer " );
295 for(
const auto& rSprite : rSortedUpdateSprites )
301 ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw();
316 const std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
320 "SpriteCanvasHelper::genericUpdate(): NULL device pointer " );
337 for(
const auto& rSprite : rSortedUpdateSprites )
343 ::boost::polymorphic_downcast< Sprite* >( rSprite.get() )->redraw();
void intersect(const Range2D &rRange)
This class manages smooth SpriteCanvas updates.
void forEachSpriteArea(Functor &rFunc) const
Call given functor for each sprite area that needs an update.
void clearChangeRecords()
Clear sprite change records (typically directly after a screen update)
void forEachSprite(const Functor &rFunc) const
Call given functor for each active sprite.
void setTarget(const IBitmapSharedPtr &rTarget)
Set the target for rendering operations.
void setDevice(css::rendering::XGraphicDevice &rDevice)
Initialize canvas helper.
void disposing()
Release all references.
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation)
void disposing()
Dispose all internal references.
std::shared_ptr< canvas::ISurfaceProxyManager > mpSurfaceProxy
void init(SpriteCanvas &rParent, ::canvas::SpriteRedrawManager &rManager, const IDXRenderModuleSharedPtr &rRenderModule, const std::shared_ptr< canvas::ISurfaceProxyManager > &rSurfaceProxy, const DXSurfaceBitmapSharedPtr &rBackBuffer, const ::basegfx::B2ISize &rOutputOffset)
void genericUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
css::uno::Reference< css::rendering::XAnimatedSprite > createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps, sal_Int8 interpolationMode)
void backgroundPaint(const ::basegfx::B2DRange &rUpdateRect)
Gets called for simple background repaints.
DXSurfaceBitmapSharedPtr mpBackBuffer
Backbuffer, contains the static canvas render output.
bool updateScreen(const ::basegfx::B2IRectangle &rCurrArea, bool bUpdateAll, bool &io_bSurfaceDirty)
Actually perform the screen update.
mutable::basegfx::B2IRange maScrapRect
Completely temporary rect storage (used by sprite repaint)
void opaqueUpdate(const ::basegfx::B2DRange &rTotalArea, const std::vector< ::canvas::Sprite::Reference > &rSortedUpdateSprites)
css::uno::Reference< css::rendering::XSprite > createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original)
IDXRenderModuleSharedPtr mpRenderModule
DX device, handling all low-level rendering.
bool mbShowSpriteBounds
When true, show small bound rects around each sprite.
SpriteCanvas * mpSpriteSurface
For generating sprites.
void scrollUpdate(const ::basegfx::B2DRange &rMoveStart, const ::basegfx::B2DRange &rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea &rUpdateArea)
Gets called when area can be handled by scrolling.
mutable::basegfx::B2IRange maUpdateRect
Completely temporary rect storage (used by sprite repaint)
css::uno::Reference< css::rendering::XCustomSprite > createCustomSprite(const css::geometry::RealSize2D &spriteSize)
::canvas::SpriteRedrawManager * mpRedrawManager
Set from the SpriteCanvas: instance coordinating sprite redraw.
Product of this component's factory.
#define ENSURE_OR_THROW(c, m)
B2IRange fround(const B2DRange &rRange)
std::shared_ptr< DXSurfaceBitmap > DXSurfaceBitmapSharedPtr
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr