LibreOffice Module slideshow (master) 1
|
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... | |
ViewShape & | operator= (const ViewShape &)=delete |
Forbid copy assignment. More... | |
const ViewLayerSharedPtr & | getViewLayer () 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< RendererCacheEntry > | RendererCacheVector |
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... | |
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.
|
private |
Definition at line 230 of file viewshape.hxx.
|
private |
Enumerator | |
---|---|
MAX_RENDER_CACHE_ENTRIES |
Definition at line 276 of file viewshape.hxx.
|
explicit |
Create a ViewShape for the given View.
rView | The associated View object. |
Definition at line 710 of file viewshape.cxx.
References ENSURE_OR_THROW, and mpViewLayer.
|
delete |
Forbid copy construction.
|
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().
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.
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.
|
private |
Retrieve a valid iterator to renderer cache entry.
This method ensures that an internal limit of MAX_RENDER_CACHE_ENTRIES is not exceeded.
rDestinationCanvas | Destination canvas to retrieve cache entry for |
Definition at line 725 of file viewshape.cxx.
References maRenderers, and MAX_RENDER_CACHE_ENTRIES.
Referenced by getRenderer(), and render().
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.
Definition at line 760 of file viewshape.cxx.
References getCacheEntry(), and prefetch().
Referenced by draw().
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.
|
private |
Definition at line 787 of file viewshape.cxx.
References maRenderers.
Referenced by render(), and renderSprite().
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.
Forbid copy assignment.
|
staticprivate |
Prefetch Renderer for given canvas.
Definition at line 52 of file viewshape.cxx.
References cppcanvas::VCLFactory::createRenderer(), ENSURE_OR_RETURN_FALSE, slideshow::internal::ViewShape::RendererCacheEntry::getDestinationCanvas(), cppcanvas::Renderer::Parameters::maFillColor, cppcanvas::Renderer::Parameters::maFontLetterForm, cppcanvas::Renderer::Parameters::maFontName, cppcanvas::Renderer::Parameters::maFontUnderline, cppcanvas::Renderer::Parameters::maFontWeight, cppcanvas::Renderer::Parameters::maLineColor, cppcanvas::Renderer::Parameters::maTextColor, cppcanvas::Renderer::Parameters::maTextTransformation, slideshow::internal::ViewShape::RendererCacheEntry::mpDestinationCanvas, slideshow::internal::ViewShape::RendererCacheEntry::mpLastBitmap, slideshow::internal::ViewShape::RendererCacheEntry::mpLastBitmapCanvas, slideshow::internal::ViewShape::RendererCacheEntry::mpMtf, slideshow::internal::ViewShape::RendererCacheEntry::mpRenderer, basegfx::B2DHomMatrix::scale(), and basegfx::B2DHomMatrix::translate().
Referenced by getRenderer().
|
private |
Render shape to given canvas.
Definition at line 497 of file viewshape.cxx.
References Content, cppcanvas::BaseGfxFactory::createAlphaBitmap(), basegfx::utils::createTranslateB2DHomMatrix(), draw(), ENSURE_OR_THROW, getCacheEntry(), basegfx::Range2D< typename TYPE, typename TRAITS >::getHeight(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMinX(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMinY(), slideshow::internal::getShapeTransformation(), basegfx::Range2D< typename TYPE, typename TRAITS >::getWidth(), invalidateRenderer(), basegfx::B2DHomMatrix::invert(), basegfx::B2DHomMatrix::isInvertible(), mbForceUpdate, NONE, SAL_INFO, and basegfx::B2DHomMatrix::translate().
Referenced by update().
|
private |
Render shape to an active sprite.
Definition at line 278 of file viewshape.cxx.
References Alpha, cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE, clamp(), Clip, Content, draw(), ENSURE_OR_RETURN_FALSE, Force, basegfx::Size2D< typename TYPE >::getHeight(), slideshow::internal::getSpriteTransformation(), basegfx::Size2D< typename TYPE >::getWidth(), invalidateRenderer(), mbForceUpdate, mpSprite, mpViewLayer, SAL_INFO, basegfx::B2DHomMatrix::scale(), basegfx::B2DHomMatrix::set(), basegfx::B2DPolyPolygon::transform(), and basegfx::B2DHomMatrix::translate().
Referenced by 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.
rMtf | The metafile representation of the shape |
rArgs | Parameter structure, containing all necessary arguments |
nUpdateFlags | Bitmask of things to update. Use FORCE to force a repaint. |
bIsVisible | When false, the shape is fully invisible (and possibly don't need to be painted) |
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().
|
mutableprivate |
A set of cached mtf/canvas combinations.
Definition at line 301 of file viewshape.hxx.
Referenced by getCacheEntry(), and invalidateRenderer().
|
mutableprivate |
If true, render() calls go to the sprite.
Definition at line 307 of file viewshape.hxx.
Referenced by enterAnimationMode(), leaveAnimationMode(), and update().
|
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().
|
mutableprivate |
The sprite object.
Definition at line 304 of file viewshape.hxx.
Referenced by leaveAnimationMode(), and renderSprite().
|
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().