LibreOffice Module slideshow (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
slideshow::internal::ViewShape Class Reference

This class is the viewable representation of a draw document's XShape, associated to a specific View. More...

#include <viewshape.hxx>

Classes

struct  RenderArgs
 
struct  RendererCacheEntry
 

Public Member Functions

 ViewShape (ViewLayerSharedPtr xViewLayer)
 Create a ViewShape for the given View. More...
 
 ViewShape (const ViewShape &)=delete
 Forbid copy construction. More...
 
ViewShapeoperator= (const ViewShape &)=delete
 Forbid copy assignment. More...
 
const ViewLayerSharedPtrgetViewLayer () const
 Query the associated view layer of this shape. More...
 
::basegfx::B2DSize getAntialiasingBorder () const
 Query dimension of a safety border around the shape for AA. More...
 
void enterAnimationMode ()
 Notify the ViewShape that an animation starts now. More...
 
void leaveAnimationMode ()
 Notify the ViewShape that it is no longer animated. More...
 
bool update (const GDIMetaFileSharedPtr &rMtf, const RenderArgs &rArgs, UpdateFlags nUpdateFlags, bool bIsVisible) const
 Update the ViewShape. More...
 
::cppcanvas::RendererSharedPtr getRenderer (const ::cppcanvas::CanvasSharedPtr &rDestinationCanvas, const GDIMetaFileSharedPtr &rMtf, const ShapeAttributeLayerSharedPtr &rAttr) const
 Retrieve renderer for given canvas and metafile. More...
 

Private Types

enum  { MAX_RENDER_CACHE_ENTRIES =2 }
 
typedef ::std::vector< RendererCacheEntryRendererCacheVector
 

Private Member Functions

bool draw (const ::cppcanvas::CanvasSharedPtr &rDestinationCanvas, const GDIMetaFileSharedPtr &rMtf, const ShapeAttributeLayerSharedPtr &rAttr, const ::basegfx::B2DHomMatrix &rTransform, const ::basegfx::B2DPolyPolygon *pClip, const VectorOfDocTreeNodes &rSubsets) const
 Draw with prefetched Renderer to stored canvas. More...
 
bool renderSprite (const ViewLayerSharedPtr &rViewLayer, const GDIMetaFileSharedPtr &rMtf, const ::basegfx::B2DRectangle &rOrigBounds, const ::basegfx::B2DRectangle &rBounds, const ::basegfx::B2DRectangle &rUnitBounds, UpdateFlags nUpdateFlags, const ShapeAttributeLayerSharedPtr &pAttr, const VectorOfDocTreeNodes &rSubsets, double nPrio, bool bIsVisible) const
 Render shape to an active sprite. More...
 
bool render (const ::cppcanvas::CanvasSharedPtr &rDestinationCanvas, const GDIMetaFileSharedPtr &rMtf, const ::basegfx::B2DRectangle &rBounds, const ::basegfx::B2DRectangle &rUpdateBounds, UpdateFlags nUpdateFlags, const ShapeAttributeLayerSharedPtr &pAttr, const VectorOfDocTreeNodes &rSubsets, bool bIsVisible) const
 Render shape to given canvas. More...
 
RendererCacheVector::iterator getCacheEntry (const ::cppcanvas::CanvasSharedPtr &rDestinationCanvas) const
 Retrieve a valid iterator to renderer cache entry. More...
 
void invalidateRenderer () const
 

Static Private Member Functions

static bool prefetch (RendererCacheEntry &io_rCacheEntry, const ::cppcanvas::CanvasSharedPtr &rDestinationCanvas, const GDIMetaFileSharedPtr &rMtf, const ShapeAttributeLayerSharedPtr &rAttr)
 Prefetch Renderer for given canvas. More...
 

Private Attributes

ViewLayerSharedPtr mpViewLayer
 The view layer this object is part of. More...
 
RendererCacheVector maRenderers
 A set of cached mtf/canvas combinations. More...
 
AnimatedSpriteSharedPtr mpSprite
 The sprite object. More...
 
bool mbAnimationMode
 If true, render() calls go to the sprite. More...
 
bool mbForceUpdate
 If true, shape needs full repaint (and the sprite a setup, if any) More...
 

Detailed Description

This class is the viewable representation of a draw document's XShape, associated to a specific View.

The class is able to render the associated XShape on View implementations.

Definition at line 62 of file viewshape.hxx.

Member Typedef Documentation

◆ RendererCacheVector

Definition at line 230 of file viewshape.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
MAX_RENDER_CACHE_ENTRIES 

Definition at line 276 of file viewshape.hxx.

Constructor & Destructor Documentation

◆ ViewShape() [1/2]

slideshow::internal::ViewShape::ViewShape ( ViewLayerSharedPtr  xViewLayer)
explicit

Create a ViewShape for the given View.

Parameters
rViewThe associated View object.

Definition at line 710 of file viewshape.cxx.

References ENSURE_OR_THROW, and mpViewLayer.

◆ ViewShape() [2/2]

slideshow::internal::ViewShape::ViewShape ( const ViewShape )
delete

Forbid copy construction.

Member Function Documentation

◆ draw()

bool slideshow::internal::ViewShape::draw ( const ::cppcanvas::CanvasSharedPtr rDestinationCanvas,
const GDIMetaFileSharedPtr rMtf,
const ShapeAttributeLayerSharedPtr rAttr,
const ::basegfx::B2DHomMatrix rTransform,
const ::basegfx::B2DPolyPolygon pClip,
const VectorOfDocTreeNodes rSubsets 
) const
private

Draw with prefetched Renderer to stored canvas.

This method draws prefetched Renderer to its associated canvas (which happens to be mpLastCanvas).

Definition at line 171 of file viewshape.cxx.

References DBG_UNHANDLED_EXCEPTION, ENSURE_OR_RETURN_FALSE, and getRenderer().

Referenced by render(), and renderSprite().

◆ enterAnimationMode()

void slideshow::internal::ViewShape::enterAnimationMode ( )

Notify the ViewShape that an animation starts now.

This method enters animation mode on the associate target view. The shape can be animated in parallel on different views.

Definition at line 813 of file viewshape.cxx.

References mbAnimationMode, and mbForceUpdate.

◆ getAntialiasingBorder()

basegfx::B2DSize slideshow::internal::ViewShape::getAntialiasingBorder ( ) const

Query dimension of a safety border around the shape for AA.

If the view performs antialiasing, this method calculates a safety border around the shape, in the shape coordinate system, which is guaranteed to include every pixel touched when rendering the shape.

Definition at line 794 of file viewshape.cxx.

References cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE, ENSURE_OR_THROW, and mpViewLayer.

◆ getCacheEntry()

ViewShape::RendererCacheVector::iterator slideshow::internal::ViewShape::getCacheEntry ( const ::cppcanvas::CanvasSharedPtr rDestinationCanvas) const
private

Retrieve a valid iterator to renderer cache entry.

This method ensures that an internal limit of MAX_RENDER_CACHE_ENTRIES is not exceeded.

Parameters
rDestinationCanvasDestination canvas to retrieve cache entry for
Returns
a valid iterator to a renderer cache entry for the given canvas. The entry might be default-constructed (if newly added)

Definition at line 725 of file viewshape.cxx.

References maRenderers, and MAX_RENDER_CACHE_ENTRIES.

Referenced by getRenderer(), and render().

◆ getRenderer()

cppcanvas::RendererSharedPtr slideshow::internal::ViewShape::getRenderer ( const ::cppcanvas::CanvasSharedPtr rDestinationCanvas,
const GDIMetaFileSharedPtr rMtf,
const ShapeAttributeLayerSharedPtr rAttr 
) const

Retrieve renderer for given canvas and metafile.

If necessary, the renderer is created or updated for the metafile and attribute layer.

Returns
a renderer that renders to the given destination canvas

Definition at line 760 of file viewshape.cxx.

References getCacheEntry(), and prefetch().

Referenced by draw().

◆ getViewLayer()

const ViewLayerSharedPtr & slideshow::internal::ViewShape::getViewLayer ( ) const

Query the associated view layer of this shape.

Definition at line 720 of file viewshape.cxx.

References mpViewLayer.

◆ invalidateRenderer()

void slideshow::internal::ViewShape::invalidateRenderer ( ) const
private

Definition at line 787 of file viewshape.cxx.

References maRenderers.

Referenced by render(), and renderSprite().

◆ leaveAnimationMode()

void slideshow::internal::ViewShape::leaveAnimationMode ( )

Notify the ViewShape that it is no longer animated.

This methods ends animation mode on the associate target view

Definition at line 819 of file viewshape.cxx.

References mbAnimationMode, mbForceUpdate, and mpSprite.

◆ operator=()

ViewShape & slideshow::internal::ViewShape::operator= ( const ViewShape )
delete

Forbid copy assignment.

◆ prefetch()

bool slideshow::internal::ViewShape::prefetch ( RendererCacheEntry io_rCacheEntry,
const ::cppcanvas::CanvasSharedPtr rDestinationCanvas,
const GDIMetaFileSharedPtr rMtf,
const ShapeAttributeLayerSharedPtr rAttr 
)
staticprivate

◆ render()

bool slideshow::internal::ViewShape::render ( const ::cppcanvas::CanvasSharedPtr rDestinationCanvas,
const GDIMetaFileSharedPtr rMtf,
const ::basegfx::B2DRectangle rBounds,
const ::basegfx::B2DRectangle rUpdateBounds,
UpdateFlags  nUpdateFlags,
const ShapeAttributeLayerSharedPtr pAttr,
const VectorOfDocTreeNodes rSubsets,
bool  bIsVisible 
) const
private

◆ renderSprite()

bool slideshow::internal::ViewShape::renderSprite ( const ViewLayerSharedPtr rViewLayer,
const GDIMetaFileSharedPtr rMtf,
const ::basegfx::B2DRectangle rOrigBounds,
const ::basegfx::B2DRectangle rBounds,
const ::basegfx::B2DRectangle rUnitBounds,
UpdateFlags  nUpdateFlags,
const ShapeAttributeLayerSharedPtr pAttr,
const VectorOfDocTreeNodes rSubsets,
double  nPrio,
bool  bIsVisible 
) const
private

◆ update()

bool slideshow::internal::ViewShape::update ( const GDIMetaFileSharedPtr rMtf,
const RenderArgs rArgs,
UpdateFlags  nUpdateFlags,
bool  bIsVisible 
) const

Update the ViewShape.

This method updates the ViewShape on the associated view. If the shape is currently animated, the render target is the sprite, otherwise the view's canvas. This method does not render anything, if the update flags are 0.

Parameters
rMtfThe metafile representation of the shape
rArgsParameter structure, containing all necessary arguments
nUpdateFlagsBitmask of things to update. Use FORCE to force a repaint.
bIsVisibleWhen false, the shape is fully invisible (and possibly don't need to be painted)
Returns
whether the rendering finished successfully.

Definition at line 826 of file viewshape.cxx.

References ENSURE_OR_RETURN_FALSE, slideshow::internal::ViewShape::RenderArgs::maBounds, slideshow::internal::ViewShape::RenderArgs::maOrigBounds, slideshow::internal::ViewShape::RenderArgs::maUnitBounds, slideshow::internal::ViewShape::RenderArgs::maUpdateBounds, mbAnimationMode, slideshow::internal::ViewShape::RenderArgs::mnShapePriority, mpViewLayer, slideshow::internal::ViewShape::RenderArgs::mrAttr, slideshow::internal::ViewShape::RenderArgs::mrSubsets, render(), and renderSprite().

Member Data Documentation

◆ maRenderers

RendererCacheVector slideshow::internal::ViewShape::maRenderers
mutableprivate

A set of cached mtf/canvas combinations.

Definition at line 301 of file viewshape.hxx.

Referenced by getCacheEntry(), and invalidateRenderer().

◆ mbAnimationMode

bool slideshow::internal::ViewShape::mbAnimationMode
mutableprivate

If true, render() calls go to the sprite.

Definition at line 307 of file viewshape.hxx.

Referenced by enterAnimationMode(), leaveAnimationMode(), and update().

◆ mbForceUpdate

bool slideshow::internal::ViewShape::mbForceUpdate
mutableprivate

If true, shape needs full repaint (and the sprite a setup, if any)

Definition at line 310 of file viewshape.hxx.

Referenced by enterAnimationMode(), leaveAnimationMode(), render(), and renderSprite().

◆ mpSprite

AnimatedSpriteSharedPtr slideshow::internal::ViewShape::mpSprite
mutableprivate

The sprite object.

Definition at line 304 of file viewshape.hxx.

Referenced by leaveAnimationMode(), and renderSprite().

◆ mpViewLayer

ViewLayerSharedPtr slideshow::internal::ViewShape::mpViewLayer
private

The view layer this object is part of.

Needed for sprite creation

Definition at line 298 of file viewshape.hxx.

Referenced by getAntialiasingBorder(), getViewLayer(), renderSprite(), update(), and ViewShape().


The documentation for this class was generated from the following files: