summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slideshow/source/engine/shapes/drawshape.cxx28
-rw-r--r--slideshow/source/engine/shapes/drawshape.hxx4
-rw-r--r--slideshow/source/engine/shapes/viewshape.cxx18
-rw-r--r--slideshow/source/engine/shapes/viewshape.hxx33
4 files changed, 44 insertions, 39 deletions
diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx
index 143786adebb9..98f1cae40ac7 100644
--- a/slideshow/source/engine/shapes/drawshape.cxx
+++ b/slideshow/source/engine/shapes/drawshape.cxx
@@ -144,7 +144,7 @@ namespace slideshow
mnPriority);
}
- bool DrawShape::implRender( int nUpdateFlags ) const
+ bool DrawShape::implRender( UpdateFlags nUpdateFlags ) const
{
SAL_INFO( "slideshow", "::presentation::internal::DrawShape::implRender()" );
SAL_INFO( "slideshow", "::presentation::internal::DrawShape: 0x" << std::hex << this );
@@ -188,15 +188,15 @@ namespace slideshow
return true;
}
- int DrawShape::getUpdateFlags() const
+ UpdateFlags DrawShape::getUpdateFlags() const
{
// default: update nothing, unless ShapeAttributeStack
// tells us below, or if the attribute layer was revoked
- int nUpdateFlags(ViewShape::NONE);
+ UpdateFlags nUpdateFlags(UpdateFlags::NONE);
// possibly the whole shape content changed
if( mbAttributeLayerRevoked )
- nUpdateFlags = ViewShape::CONTENT;
+ nUpdateFlags = UpdateFlags::Content;
// determine what has to be updated
@@ -216,30 +216,30 @@ namespace slideshow
// content change because when the visibility
// changes then usually a sprite is shown or hidden
// and the background under has to be painted once.
- nUpdateFlags |= ViewShape::CONTENT;
+ nUpdateFlags |= UpdateFlags::Content;
}
// TODO(P1): This can be done without conditional branching.
// See HAKMEM.
if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
{
- nUpdateFlags |= ViewShape::POSITION;
+ nUpdateFlags |= UpdateFlags::Position;
}
if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
{
- nUpdateFlags |= ViewShape::ALPHA;
+ nUpdateFlags |= UpdateFlags::Alpha;
}
if( mpAttributeLayer->getClipState() != mnAttributeClipState )
{
- nUpdateFlags |= ViewShape::CLIP;
+ nUpdateFlags |= UpdateFlags::Clip;
}
if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
{
- nUpdateFlags |= ViewShape::TRANSFORMATION;
+ nUpdateFlags |= UpdateFlags::Transformation;
}
if( mpAttributeLayer->getContentState() != mnAttributeContentState )
{
- nUpdateFlags |= ViewShape::CONTENT;
+ nUpdateFlags |= UpdateFlags::Content;
}
}
}
@@ -639,7 +639,7 @@ namespace slideshow
{
pNewShape->update( mpCurrMtf,
getViewRenderArgs(),
- ViewShape::FORCE,
+ UpdateFlags::Force,
isVisible() );
}
}
@@ -695,15 +695,15 @@ namespace slideshow
// force redraw. Have to also pass on the update flags,
// because e.g. content update (regeneration of the
// metafile renderer) is normally not performed. A simple
- // ViewShape::FORCE would only paint the metafile in its
+ // UpdateFlags::Force would only paint the metafile in its
// old state.
- return implRender( ViewShape::FORCE | getUpdateFlags() );
+ return implRender( UpdateFlags::Force | getUpdateFlags() );
}
bool DrawShape::isContentChanged() const
{
return mbForceUpdate ||
- getUpdateFlags() != ViewShape::NONE;
+ getUpdateFlags() != UpdateFlags::NONE;
}
diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx
index 51dfcfff066a..7fb7cc225667 100644
--- a/slideshow/source/engine/shapes/drawshape.hxx
+++ b/slideshow/source/engine/shapes/drawshape.hxx
@@ -262,8 +262,8 @@ namespace slideshow
*/
DrawShape( const DrawShape&, const DocTreeNode& rTreeNode, double nPrio );
- int getUpdateFlags() const;
- bool implRender( int nUpdateFlags ) const;
+ UpdateFlags getUpdateFlags() const;
+ bool implRender( UpdateFlags nUpdateFlags ) const;
void updateStateIds() const;
ViewShape::RenderArgs getViewRenderArgs() const;
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index 7ea7bcc5e98a..820ec8fbe13d 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -285,7 +285,7 @@ namespace slideshow
const ::basegfx::B2DRectangle& rOrigBounds,
const ::basegfx::B2DRectangle& rBounds,
const ::basegfx::B2DRectangle& rUnitBounds,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
const ShapeAttributeLayerSharedPtr& pAttr,
const VectorOfDocTreeNodes& rSubsets,
double nPrio,
@@ -429,9 +429,9 @@ namespace slideshow
// process flags
// =============
- bool bRedrawRequired( mbForceUpdate || (nUpdateFlags & FORCE) );
+ bool bRedrawRequired( mbForceUpdate || (nUpdateFlags & UpdateFlags::Force) );
- if( mbForceUpdate || (nUpdateFlags & ALPHA) )
+ if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Alpha) )
{
mpSprite->setAlpha( (pAttr && pAttr->isAlphaValid()) ?
::basegfx::clamp(pAttr->getAlpha(),
@@ -439,7 +439,7 @@ namespace slideshow
1.0) :
1.0 );
}
- if( mbForceUpdate || (nUpdateFlags & CLIP) )
+ if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Clip) )
{
if( pAttr && pAttr->isClipValid() )
{
@@ -468,7 +468,7 @@ namespace slideshow
else
mpSprite->clip();
}
- if( mbForceUpdate || (nUpdateFlags & CONTENT) )
+ if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Content) )
{
bRedrawRequired = true;
@@ -503,7 +503,7 @@ namespace slideshow
const GDIMetaFileSharedPtr& rMtf,
const ::basegfx::B2DRectangle& rBounds,
const ::basegfx::B2DRectangle& rUpdateBounds,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
const ShapeAttributeLayerSharedPtr& pAttr,
const VectorOfDocTreeNodes& rSubsets,
bool bIsVisible ) const
@@ -522,9 +522,9 @@ namespace slideshow
// since we have no sprite here, _any_ update request
// translates into a required redraw.
- bool bRedrawRequired( mbForceUpdate || nUpdateFlags != 0 );
+ bool bRedrawRequired( mbForceUpdate || nUpdateFlags != UpdateFlags::NONE );
- if( (nUpdateFlags & CONTENT) )
+ if( nUpdateFlags & UpdateFlags::Content )
{
// TODO(P1): maybe provide some appearance change methods at
// the Renderer interface
@@ -832,7 +832,7 @@ namespace slideshow
bool ViewShape::update( const GDIMetaFileSharedPtr& rMtf,
const RenderArgs& rArgs,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
bool bIsVisible ) const
{
ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
diff --git a/slideshow/source/engine/shapes/viewshape.hxx b/slideshow/source/engine/shapes/viewshape.hxx
index 4eb2f7c1e7c5..84405dd590a7 100644
--- a/slideshow/source/engine/shapes/viewshape.hxx
+++ b/slideshow/source/engine/shapes/viewshape.hxx
@@ -25,6 +25,7 @@
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include "tools.hxx"
#include "shapeattributelayer.hxx"
@@ -35,6 +36,21 @@
#include <vector>
#include <memory>
+enum class UpdateFlags
+{
+ NONE = 0x00,
+ Transformation = 0x01,
+ Clip = 0x02,
+ Alpha = 0x04,
+ Position = 0x08,
+ Content = 0x10,
+ Force = 0x20,
+};
+namespace o3tl {
+ template<> struct typed_flags<UpdateFlags> : is_typed_flags<UpdateFlags, 0x3f> {};
+}
+
+
namespace slideshow
{
@@ -99,17 +115,6 @@ namespace slideshow
// render methods
- enum UpdateFlags
- {
- NONE= 0,
- TRANSFORMATION= 1,
- CLIP= 2,
- ALPHA= 4,
- POSITION= 8,
- CONTENT= 16,
- FORCE= 32
- };
-
struct RenderArgs
{
/** Create render argument struct
@@ -187,7 +192,7 @@ namespace slideshow
*/
bool update( const GDIMetaFileSharedPtr& rMtf,
const RenderArgs& rArgs,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
bool bIsVisible ) const;
/** Retrieve renderer for given canvas and metafile.
@@ -256,7 +261,7 @@ namespace slideshow
const ::basegfx::B2DRectangle& rOrigBounds,
const ::basegfx::B2DRectangle& rBounds,
const ::basegfx::B2DRectangle& rUnitBounds,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
const ShapeAttributeLayerSharedPtr& pAttr,
const VectorOfDocTreeNodes& rSubsets,
double nPrio,
@@ -268,7 +273,7 @@ namespace slideshow
const GDIMetaFileSharedPtr& rMtf,
const ::basegfx::B2DRectangle& rBounds,
const ::basegfx::B2DRectangle& rUpdateBounds,
- int nUpdateFlags,
+ UpdateFlags nUpdateFlags,
const ShapeAttributeLayerSharedPtr& pAttr,
const VectorOfDocTreeNodes& rSubsets,
bool bIsVisible ) const;