convert UpdateFlags to scoped enum
Change-Id: I73121e85a927bae3f042a2bbc0283a28067b891f Reviewed-on: https://gerrit.libreoffice.org/35553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -144,7 +144,7 @@ namespace slideshow
|
|||||||
mnPriority);
|
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::implRender()" );
|
||||||
SAL_INFO( "slideshow", "::presentation::internal::DrawShape: 0x" << std::hex << this );
|
SAL_INFO( "slideshow", "::presentation::internal::DrawShape: 0x" << std::hex << this );
|
||||||
@@ -188,15 +188,15 @@ namespace slideshow
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DrawShape::getUpdateFlags() const
|
UpdateFlags DrawShape::getUpdateFlags() const
|
||||||
{
|
{
|
||||||
// default: update nothing, unless ShapeAttributeStack
|
// default: update nothing, unless ShapeAttributeStack
|
||||||
// tells us below, or if the attribute layer was revoked
|
// tells us below, or if the attribute layer was revoked
|
||||||
int nUpdateFlags(ViewShape::NONE);
|
UpdateFlags nUpdateFlags(UpdateFlags::NONE);
|
||||||
|
|
||||||
// possibly the whole shape content changed
|
// possibly the whole shape content changed
|
||||||
if( mbAttributeLayerRevoked )
|
if( mbAttributeLayerRevoked )
|
||||||
nUpdateFlags = ViewShape::CONTENT;
|
nUpdateFlags = UpdateFlags::Content;
|
||||||
|
|
||||||
|
|
||||||
// determine what has to be updated
|
// determine what has to be updated
|
||||||
@@ -216,30 +216,30 @@ namespace slideshow
|
|||||||
// content change because when the visibility
|
// content change because when the visibility
|
||||||
// changes then usually a sprite is shown or hidden
|
// changes then usually a sprite is shown or hidden
|
||||||
// and the background under has to be painted once.
|
// and the background under has to be painted once.
|
||||||
nUpdateFlags |= ViewShape::CONTENT;
|
nUpdateFlags |= UpdateFlags::Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(P1): This can be done without conditional branching.
|
// TODO(P1): This can be done without conditional branching.
|
||||||
// See HAKMEM.
|
// See HAKMEM.
|
||||||
if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
|
if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
|
||||||
{
|
{
|
||||||
nUpdateFlags |= ViewShape::POSITION;
|
nUpdateFlags |= UpdateFlags::Position;
|
||||||
}
|
}
|
||||||
if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
|
if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
|
||||||
{
|
{
|
||||||
nUpdateFlags |= ViewShape::ALPHA;
|
nUpdateFlags |= UpdateFlags::Alpha;
|
||||||
}
|
}
|
||||||
if( mpAttributeLayer->getClipState() != mnAttributeClipState )
|
if( mpAttributeLayer->getClipState() != mnAttributeClipState )
|
||||||
{
|
{
|
||||||
nUpdateFlags |= ViewShape::CLIP;
|
nUpdateFlags |= UpdateFlags::Clip;
|
||||||
}
|
}
|
||||||
if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
|
if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
|
||||||
{
|
{
|
||||||
nUpdateFlags |= ViewShape::TRANSFORMATION;
|
nUpdateFlags |= UpdateFlags::Transformation;
|
||||||
}
|
}
|
||||||
if( mpAttributeLayer->getContentState() != mnAttributeContentState )
|
if( mpAttributeLayer->getContentState() != mnAttributeContentState )
|
||||||
{
|
{
|
||||||
nUpdateFlags |= ViewShape::CONTENT;
|
nUpdateFlags |= UpdateFlags::Content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +639,7 @@ namespace slideshow
|
|||||||
{
|
{
|
||||||
pNewShape->update( mpCurrMtf,
|
pNewShape->update( mpCurrMtf,
|
||||||
getViewRenderArgs(),
|
getViewRenderArgs(),
|
||||||
ViewShape::FORCE,
|
UpdateFlags::Force,
|
||||||
isVisible() );
|
isVisible() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,15 +695,15 @@ namespace slideshow
|
|||||||
// force redraw. Have to also pass on the update flags,
|
// force redraw. Have to also pass on the update flags,
|
||||||
// because e.g. content update (regeneration of the
|
// because e.g. content update (regeneration of the
|
||||||
// metafile renderer) is normally not performed. A simple
|
// 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.
|
// old state.
|
||||||
return implRender( ViewShape::FORCE | getUpdateFlags() );
|
return implRender( UpdateFlags::Force | getUpdateFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawShape::isContentChanged() const
|
bool DrawShape::isContentChanged() const
|
||||||
{
|
{
|
||||||
return mbForceUpdate ||
|
return mbForceUpdate ||
|
||||||
getUpdateFlags() != ViewShape::NONE;
|
getUpdateFlags() != UpdateFlags::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -262,8 +262,8 @@ namespace slideshow
|
|||||||
*/
|
*/
|
||||||
DrawShape( const DrawShape&, const DocTreeNode& rTreeNode, double nPrio );
|
DrawShape( const DrawShape&, const DocTreeNode& rTreeNode, double nPrio );
|
||||||
|
|
||||||
int getUpdateFlags() const;
|
UpdateFlags getUpdateFlags() const;
|
||||||
bool implRender( int nUpdateFlags ) const;
|
bool implRender( UpdateFlags nUpdateFlags ) const;
|
||||||
void updateStateIds() const;
|
void updateStateIds() const;
|
||||||
|
|
||||||
ViewShape::RenderArgs getViewRenderArgs() const;
|
ViewShape::RenderArgs getViewRenderArgs() const;
|
||||||
|
@@ -285,7 +285,7 @@ namespace slideshow
|
|||||||
const ::basegfx::B2DRectangle& rOrigBounds,
|
const ::basegfx::B2DRectangle& rOrigBounds,
|
||||||
const ::basegfx::B2DRectangle& rBounds,
|
const ::basegfx::B2DRectangle& rBounds,
|
||||||
const ::basegfx::B2DRectangle& rUnitBounds,
|
const ::basegfx::B2DRectangle& rUnitBounds,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
const ShapeAttributeLayerSharedPtr& pAttr,
|
const ShapeAttributeLayerSharedPtr& pAttr,
|
||||||
const VectorOfDocTreeNodes& rSubsets,
|
const VectorOfDocTreeNodes& rSubsets,
|
||||||
double nPrio,
|
double nPrio,
|
||||||
@@ -429,9 +429,9 @@ namespace slideshow
|
|||||||
// process flags
|
// 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()) ?
|
mpSprite->setAlpha( (pAttr && pAttr->isAlphaValid()) ?
|
||||||
::basegfx::clamp(pAttr->getAlpha(),
|
::basegfx::clamp(pAttr->getAlpha(),
|
||||||
@@ -439,7 +439,7 @@ namespace slideshow
|
|||||||
1.0) :
|
1.0) :
|
||||||
1.0 );
|
1.0 );
|
||||||
}
|
}
|
||||||
if( mbForceUpdate || (nUpdateFlags & CLIP) )
|
if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Clip) )
|
||||||
{
|
{
|
||||||
if( pAttr && pAttr->isClipValid() )
|
if( pAttr && pAttr->isClipValid() )
|
||||||
{
|
{
|
||||||
@@ -468,7 +468,7 @@ namespace slideshow
|
|||||||
else
|
else
|
||||||
mpSprite->clip();
|
mpSprite->clip();
|
||||||
}
|
}
|
||||||
if( mbForceUpdate || (nUpdateFlags & CONTENT) )
|
if( mbForceUpdate || (nUpdateFlags & UpdateFlags::Content) )
|
||||||
{
|
{
|
||||||
bRedrawRequired = true;
|
bRedrawRequired = true;
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ namespace slideshow
|
|||||||
const GDIMetaFileSharedPtr& rMtf,
|
const GDIMetaFileSharedPtr& rMtf,
|
||||||
const ::basegfx::B2DRectangle& rBounds,
|
const ::basegfx::B2DRectangle& rBounds,
|
||||||
const ::basegfx::B2DRectangle& rUpdateBounds,
|
const ::basegfx::B2DRectangle& rUpdateBounds,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
const ShapeAttributeLayerSharedPtr& pAttr,
|
const ShapeAttributeLayerSharedPtr& pAttr,
|
||||||
const VectorOfDocTreeNodes& rSubsets,
|
const VectorOfDocTreeNodes& rSubsets,
|
||||||
bool bIsVisible ) const
|
bool bIsVisible ) const
|
||||||
@@ -522,9 +522,9 @@ namespace slideshow
|
|||||||
|
|
||||||
// since we have no sprite here, _any_ update request
|
// since we have no sprite here, _any_ update request
|
||||||
// translates into a required redraw.
|
// 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
|
// TODO(P1): maybe provide some appearance change methods at
|
||||||
// the Renderer interface
|
// the Renderer interface
|
||||||
@@ -832,7 +832,7 @@ namespace slideshow
|
|||||||
|
|
||||||
bool ViewShape::update( const GDIMetaFileSharedPtr& rMtf,
|
bool ViewShape::update( const GDIMetaFileSharedPtr& rMtf,
|
||||||
const RenderArgs& rArgs,
|
const RenderArgs& rArgs,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
bool bIsVisible ) const
|
bool bIsVisible ) const
|
||||||
{
|
{
|
||||||
ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
|
ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" );
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <basegfx/range/b2drectangle.hxx>
|
#include <basegfx/range/b2drectangle.hxx>
|
||||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||||
|
#include <o3tl/typed_flags_set.hxx>
|
||||||
|
|
||||||
#include "tools.hxx"
|
#include "tools.hxx"
|
||||||
#include "shapeattributelayer.hxx"
|
#include "shapeattributelayer.hxx"
|
||||||
@@ -35,6 +36,21 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#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
|
namespace slideshow
|
||||||
{
|
{
|
||||||
@@ -99,17 +115,6 @@ namespace slideshow
|
|||||||
// render methods
|
// render methods
|
||||||
|
|
||||||
|
|
||||||
enum UpdateFlags
|
|
||||||
{
|
|
||||||
NONE= 0,
|
|
||||||
TRANSFORMATION= 1,
|
|
||||||
CLIP= 2,
|
|
||||||
ALPHA= 4,
|
|
||||||
POSITION= 8,
|
|
||||||
CONTENT= 16,
|
|
||||||
FORCE= 32
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RenderArgs
|
struct RenderArgs
|
||||||
{
|
{
|
||||||
/** Create render argument struct
|
/** Create render argument struct
|
||||||
@@ -187,7 +192,7 @@ namespace slideshow
|
|||||||
*/
|
*/
|
||||||
bool update( const GDIMetaFileSharedPtr& rMtf,
|
bool update( const GDIMetaFileSharedPtr& rMtf,
|
||||||
const RenderArgs& rArgs,
|
const RenderArgs& rArgs,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
bool bIsVisible ) const;
|
bool bIsVisible ) const;
|
||||||
|
|
||||||
/** Retrieve renderer for given canvas and metafile.
|
/** Retrieve renderer for given canvas and metafile.
|
||||||
@@ -256,7 +261,7 @@ namespace slideshow
|
|||||||
const ::basegfx::B2DRectangle& rOrigBounds,
|
const ::basegfx::B2DRectangle& rOrigBounds,
|
||||||
const ::basegfx::B2DRectangle& rBounds,
|
const ::basegfx::B2DRectangle& rBounds,
|
||||||
const ::basegfx::B2DRectangle& rUnitBounds,
|
const ::basegfx::B2DRectangle& rUnitBounds,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
const ShapeAttributeLayerSharedPtr& pAttr,
|
const ShapeAttributeLayerSharedPtr& pAttr,
|
||||||
const VectorOfDocTreeNodes& rSubsets,
|
const VectorOfDocTreeNodes& rSubsets,
|
||||||
double nPrio,
|
double nPrio,
|
||||||
@@ -268,7 +273,7 @@ namespace slideshow
|
|||||||
const GDIMetaFileSharedPtr& rMtf,
|
const GDIMetaFileSharedPtr& rMtf,
|
||||||
const ::basegfx::B2DRectangle& rBounds,
|
const ::basegfx::B2DRectangle& rBounds,
|
||||||
const ::basegfx::B2DRectangle& rUpdateBounds,
|
const ::basegfx::B2DRectangle& rUpdateBounds,
|
||||||
int nUpdateFlags,
|
UpdateFlags nUpdateFlags,
|
||||||
const ShapeAttributeLayerSharedPtr& pAttr,
|
const ShapeAttributeLayerSharedPtr& pAttr,
|
||||||
const VectorOfDocTreeNodes& rSubsets,
|
const VectorOfDocTreeNodes& rSubsets,
|
||||||
bool bIsVisible ) const;
|
bool bIsVisible ) const;
|
||||||
|
Reference in New Issue
Block a user