Notethat,althoughthisclassgenerallyworkswithIEEE doubles,thecalculationofconnectedareashappensinthe integerdomain-itisgenerallyexpectedthatrepaintscan onlybedividedatpixelboundaries,withoutcausingvisible artifacts.Therefore,spritesthattouchthesamepixel(but don'tnecessarilyhavethesamefloatingpointcoordinates there)willresideinacommonspriteareaandhandled togetherintheforEachSpriteAreafunctorcall.
*/ class CANVASTOOLS_DLLPUBLIC SpriteRedrawManager
{ public: /** Data container for the connected components list
*/ class SpriteInfo
{ public: /** Create sprite info
// #i61843# need to return by value here, to be used safely from bind const ::basegfx::B2DRange& getUpdateArea() const { return maTrueUpdateArea; } bool needsUpdate() const { return mbNeedsUpdate; } bool isPureMove() const { return mbIsPureMove; }
@internal
*/ template< typename Functor > void handleArea( Functor& rFunc, const UpdateArea& rUpdateArea ) const
{ // check whether this area contains changed sprites at all // (if not, just ignore it) if( !areSpritesChanged( rUpdateArea ) ) return;
// at least one of the sprites actually needs an // update - process whole area.
// check whether this area could be handled special // (background paint, direct update, scroll, etc.)
::basegfx::B2DRange aMoveStart;
::basegfx::B2DRange aMoveEnd; if( rUpdateArea.maComponentList.empty() )
{
rFunc.backgroundPaint( rUpdateArea.maTotalBounds );
} else
{ // cache number of sprites in this area (it's a // list, and both isAreaUpdateScroll() and // isAreaUpdateOpaque() need it). const ::std::size_t nNumSprites(
rUpdateArea.maComponentList.size() );
if( isAreaUpdateScroll( aMoveStart,
aMoveEnd,
rUpdateArea,
nNumSprites ) )
{
rFunc.scrollUpdate( aMoveStart,
aMoveEnd,
rUpdateArea );
} else
{ // potentially, more than a single sprite // involved. Have to sort component lists for // sprite prio.
VectorOfSprites aSortedUpdateSprites; for (autoconst& elem : rUpdateArea.maComponentList)
{ const Sprite::Reference& rSprite( elem.second.getSprite() ); if( rSprite.is() )
aSortedUpdateSprites.push_back( rSprite );
}
private: /** Central method of this class. Calculates the set of disjunctcomponentsthatneedanupdate.
*/ void setupUpdateAreas( SpriteConnectedRanges& rUpdateAreas ) const;
VectorOfSprites maSprites; // list of active // sprite // objects. this // list is only // used for full // repaints, // otherwise, we // rely on the // active sprites // itself to notify // us.
VectorOfChangeRecords maChangeRecords; // vector of // sprites // changes // since last // updateScreen() // call
};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.