Gnash
0.8.11dev
|
A list of on-stage DisplayObjects, ordered by depth. More...
#include <DisplayList.h>
Public Types | |
typedef std::list< DisplayObject * > | container_type |
typedef container_type::iterator | iterator |
typedef container_type::const_iterator | const_iterator |
typedef container_type::reverse_iterator | reverse_iterator |
typedef container_type::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
DisplayList () | |
~DisplayList () | |
DSOTEXPORT void | placeDisplayObject (DisplayObject *ch, int depth) |
Place a new DisplayObject at the specified depth, replacing any existing DisplayObject at the same depth. More... | |
void | replaceDisplayObject (DisplayObject *ch, int depth, bool use_old_cxform, bool use_old_matrix) |
Replace the old DisplayObject at the specified depth with the given new DisplayObject. More... | |
void | swapDepths (DisplayObject *ch, int depth) |
Change depth of the given DisplayObjects in the list, swapping with any existing DisplayObject at target depth. More... | |
void | moveDisplayObject (int depth, const SWFCxForm *color_xform, const SWFMatrix *mat, std::uint16_t *ratio) |
Updates the transform properties of the object at the specified depth, unless its get_accept_anim_moves() returns false. More... | |
void | removeDisplayObject (int depth) |
Removes the object at the specified depth. More... | |
void | removeUnloaded () |
Remove all unloaded DisplayObject from the list. More... | |
bool | unload () |
void | destroy () |
destroy all DisplayObjects in this DisplayList More... | |
void | add (DisplayObject *ch, bool replace) |
Add a DisplayObject in the list, maintaining depth-order. More... | |
void | insertDisplayObject (DisplayObject *obj, int index) |
Inserts a DisplayObject at the specified index (depth) More... | |
void | display (Renderer &renderer, const Transform &xform) |
Display the list's DisplayObjects. More... | |
void | omit_display () |
DSOTEXPORT DisplayObject * | getDisplayObjectAtDepth (int depth) const |
May return NULL. More... | |
DSOTEXPORT DisplayObject * | getDisplayObjectByName (string_table &st, const ObjectURI &uri, bool caseless) const |
If there are multiples, returns the first match only! More... | |
template<class V > | |
void | visitBackward (V &visitor) |
Visit each DisplayObject in the list in reverse depth order (higher depth first). More... | |
template<class V > | |
void | visitBackward (V &visitor) const |
template<class V > | |
void | visitAll (V &visitor) |
Visit each and all DisplayObject in the list. More... | |
template<class V > | |
void | visitAll (V &visitor) const |
void | add_invalidated_bounds (InvalidatedRanges &ranges, bool force) |
size_t | size () const |
Return number of elements in the list. More... | |
bool | empty () const |
Return true if the list contains no elements. More... | |
int | getNextHighestDepth () const |
Return the next highest available depth. More... | |
void | mergeDisplayList (DisplayList &newList, DisplayObject &o) |
Merge the given display list. More... | |
bool | operator== (const DisplayList &other) const |
bool | operator!= (const DisplayList &other) const |
void | testInvariant () const |
Friends | |
std::ostream & | operator<< (std::ostream &, const DisplayList &) |
Output operator. More... | |
A list of on-stage DisplayObjects, ordered by depth.
Any MovieClip has an associated DisplayList that may change from frame to frame due to control tags instructing when to add or remove DisplayObjects from the stage.
typedef container_type::const_iterator gnash::DisplayList::const_iterator |
typedef container_type::const_reverse_iterator gnash::DisplayList::const_reverse_iterator |
typedef std::list<DisplayObject*> gnash::DisplayList::container_type |
typedef container_type::iterator gnash::DisplayList::iterator |
typedef container_type::reverse_iterator gnash::DisplayList::reverse_iterator |
|
inline |
|
inline |
References add(), add_invalidated_bounds(), gnash::caseless(), destroy(), display(), DSOTEXPORT, getDisplayObjectAtDepth(), getDisplayObjectByName(), insertDisplayObject(), moveDisplayObject(), omit_display(), operator<<, placeDisplayObject(), removeDisplayObject(), removeUnloaded(), replaceDisplayObject(), swapDepths(), unload(), test::uri, gnash::key::V, visitAll(), and visitBackward().
void gnash::DisplayList::add | ( | DisplayObject * | ch, |
bool | replace | ||
) |
Add a DisplayObject in the list, maintaining depth-order.
ch | The DisplayObject to add |
replace | If true the given DisplayObject would replace any pre-existing DisplayObject at the same depth. |
References gnash::key::_1, and gnash::DisplayObject::get_depth().
Referenced by ~DisplayList().
void gnash::DisplayList::add_invalidated_bounds | ( | InvalidatedRanges & | ranges, |
bool | force | ||
) |
Like DisplayObject_instance::add_invalidated_bounds() this method calls the method with the same name of all childs.
References gnash::geometry::SnappingRanges2d< T >::add(), gnash::DisplayObject::add_invalidated_bounds(), gnash::DisplayObject::get_clip_depth(), gnash::DisplayObject::get_depth(), gnash::geometry::SnappingRanges2d< T >::inheritConfig(), gnash::geometry::SnappingRanges2d< T >::intersect(), and gnash::DisplayObject::isMaskLayer().
Referenced by gnash::MovieClip::add_invalidated_bounds(), and ~DisplayList().
void gnash::DisplayList::destroy | ( | ) |
destroy all DisplayObjects in this DisplayList
References gnash::DisplayObject::destroy(), and gnash::DisplayObject::isDestroyed().
Referenced by gnash::MovieClip::destroy(), and ~DisplayList().
Display the list's DisplayObjects.
Lower depths are obscured by higher depths.
References gnash::Renderer::begin_submit_mask(), gnash::DisplayObject::boundsInClippingArea(), gnash::Renderer::disable_mask(), gnash::DisplayObject::display(), gnash::Renderer::end_submit_mask(), gnash::DisplayObject::get_clip_depth(), gnash::DisplayObject::get_depth(), gnash::DisplayObject::isDestroyed(), gnash::DisplayObject::isDynamicMask(), gnash::DisplayObject::isMaskLayer(), gnash::DisplayObject::omit_display(), gnash::key::p, gnash::DisplayObject::parent(), gnash::DisplayObject::unloaded(), and gnash::DisplayObject::visible().
Referenced by gnash::MovieClip::draw(), and ~DisplayList().
|
inline |
Return true if the list contains no elements.
References getNextHighestDepth(), mergeDisplayList(), and gnash::key::o.
DisplayObject * gnash::DisplayList::getDisplayObjectAtDepth | ( | int | depth | ) | const |
May return NULL.
Referenced by gnash::MovieClip::add_display_object(), gnash::MovieClip::getDisplayObjectAtDepth(), gnash::MovieClip::replace_display_object(), and ~DisplayList().
DisplayObject * gnash::DisplayList::getDisplayObjectByName | ( | string_table & | st, |
const ObjectURI & | uri, | ||
bool | caseless | ||
) | const |
If there are multiples, returns the first match only!
st | The string_table to use for finding lowercase equivalent of names if `caseless' parameter is true. |
uri | Object identifier |
caseless | Wheter comparison must be case-insensitive. |
References gnash::key::e.
Referenced by gnash::MovieClip::getDisplayListObject(), and ~DisplayList().
int gnash::DisplayList::getNextHighestDepth | ( | ) | const |
Return the next highest available depth.
Placing an object at the depth returned by this function should result in a DisplayObject that is displayd above all others
Referenced by empty().
void gnash::DisplayList::insertDisplayObject | ( | DisplayObject * | obj, |
int | index | ||
) |
Inserts a DisplayObject at the specified index (depth)
If a DisplayObject is already at that index, it is moved up. This implements AS3 DisplayObjectContainer.addChildAt().
obj | The DisplayObject to insert. This should already be removed from any other DisplayLists. It should not be the owner of this DisplayList or any parent of that owner. |
index | The index at which to insert the DisplayObject. |
References gnash::key::_1, gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), and gnash::DisplayObject::unloaded().
Referenced by ~DisplayList().
void gnash::DisplayList::mergeDisplayList | ( | DisplayList & | newList, |
DisplayObject & | o | ||
) |
Merge the given display list.
Call set_invalidated on the given DisplayObject if this list changes
References _, gnash::key::_1, gnash::DisplayObject::destroy(), gnash::key::e, gnash::DisplayObject::get_accept_anim_moves(), gnash::DisplayObject::get_depth(), gnash::DisplayObject::get_ratio(), gnash::getCxForm(), gnash::getMatrix(), gnash::DisplayObject::getTarget(), gnash::key::i, gnash::DisplayObject::isDestroyed(), gnash::DisplayObject::isDynamic(), gnash::isReferenceable(), gnash::log_error(), gnash::DisplayObject::removedDepthOffset, gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), gnash::DisplayObject::setCxForm(), gnash::DisplayObject::setMatrix(), gnash::DisplayObject::staticDepthOffset, gnash::typeName(), gnash::DisplayObject::unload(), and gnash::DisplayObject::unloaded().
Referenced by empty(), and gnash::MovieClip::execute_action().
void gnash::DisplayList::moveDisplayObject | ( | int | depth, |
const SWFCxForm * | color_xform, | ||
const SWFMatrix * | mat, | ||
std::uint16_t * | ratio | ||
) |
Updates the transform properties of the object at the specified depth, unless its get_accept_anim_moves() returns false.
See DisplayObject::get_accept_anim_moves()
color_xform | The color tranform to assign to the DisplayObject at the given depth. If NULL the orignial color transform will be kept. |
mat | The SWFMatrix tranform to assign to the DisplayObject at the given depth. If NULL the orignial SWFMatrix will be kept. |
ratio | The new ratio value to assign to the DisplayObject at the given depth. If NULL the original ratio will be kept. |
References _, gnash::DisplayObject::get_accept_anim_moves(), IF_VERBOSE_MALFORMED_SWF, gnash::log_error(), gnash::log_swferror(), gnash::DisplayObject::set_ratio(), gnash::DisplayObject::setCxForm(), gnash::DisplayObject::setMatrix(), and gnash::DisplayObject::unloaded().
Referenced by gnash::MovieClip::move_display_object(), and ~DisplayList().
void gnash::DisplayList::omit_display | ( | ) |
References gnash::DisplayObject::omit_display().
Referenced by gnash::MovieClip::omit_display(), and ~DisplayList().
|
inline |
References gnash::DisplayObject::get_depth(), gnash::log_debug(), and testInvariant().
|
inline |
void gnash::DisplayList::placeDisplayObject | ( | DisplayObject * | ch, |
int | depth | ||
) |
Place a new DisplayObject at the specified depth, replacing any existing DisplayObject at the same depth.
If a DisplayObject is replaced, it's unload() method is invoked.
If applicable, the event_id::LOAD event associated with the given DisplayObject is called as last step of addition.
ch | the new DisplayObject to be added into the list. |
depth | depth at which the new DisplayObject is placed. |
References gnash::key::_1, gnash::DisplayObject::destroy(), gnash::DisplayObject::extend_invalidated_bounds(), gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), gnash::DisplayObject::unload(), and gnash::DisplayObject::unloaded().
Referenced by gnash::MovieClip::add_display_object(), gnash::MovieClip::addDisplayListObject(), gnash::MovieClip::attachCharacter(), gnash::MovieClip::duplicateMovieClip(), and ~DisplayList().
void gnash::DisplayList::removeDisplayObject | ( | int | depth | ) |
Removes the object at the specified depth.
Calls unload on the removed DisplayObject.
References gnash::key::_1, gnash::DisplayObject::destroy(), and gnash::DisplayObject::unload().
Referenced by gnash::SWF::RemoveObjectTag::executeState(), gnash::MovieClip::remove_display_object(), and ~DisplayList().
void gnash::DisplayList::removeUnloaded | ( | ) |
Remove all unloaded DisplayObject from the list.
Removed DisplayObjects still in the list are those on which onUnload event handlers were defined..
NOTE: we don't call the function recursively in the contained elements, as that should not be needed (ie: any inned thing will not be accessible anyway)
References gnash::key::_1, gnash::key::c, gnash::DisplayObject::removedDepthOffset, gnash::DisplayObject::staticDepthOffset, and gnash::DisplayObject::unloaded().
Referenced by gnash::MovieClip::cleanupDisplayList(), and ~DisplayList().
void gnash::DisplayList::replaceDisplayObject | ( | DisplayObject * | ch, |
int | depth, | ||
bool | use_old_cxform, | ||
bool | use_old_matrix | ||
) |
Replace the old DisplayObject at the specified depth with the given new DisplayObject.
Calls unload on the removed DisplayObject.
ch | the new DisplayObject to be put |
depth | depth to be replaced |
use_old_cxform | true: set the new DisplayObject's SWFCxForm to the old one. false: keep the new DisplayObject's SWFCxForm. |
use_old_matrix | true: set the new DisplayObject's transformation SWFMatrix to the old one. false: keep the new DisplayObject's transformation SWFMatrix. |
References gnash::key::_1, gnash::DisplayObject::add_invalidated_bounds(), gnash::DisplayObject::destroy(), gnash::DisplayObject::extend_invalidated_bounds(), gnash::getCxForm(), gnash::getMatrix(), gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), gnash::DisplayObject::setCxForm(), gnash::DisplayObject::setMatrix(), gnash::DisplayObject::unload(), and gnash::DisplayObject::unloaded().
Referenced by gnash::MovieClip::getLoadedMovie(), gnash::MovieClip::replace_display_object(), and ~DisplayList().
|
inline |
Return number of elements in the list.
Referenced by gnash::DisplayObjectContainer::numChildren().
void gnash::DisplayList::swapDepths | ( | DisplayObject * | ch, |
int | depth | ||
) |
Change depth of the given DisplayObjects in the list, swapping with any existing DisplayObject at target depth.
List ordering will be maintained by this function.
Any DisplayObject affected by this operation (none on invalid call, 1 if new depth is not occupied, 2 otherwise) will be:
ch | The DisplayObject to apply depth swapping to. If not found in the list, an error is raised and no other action is taken. |
depth | The new depth to assign to the given DisplayObject. If occupied by another DisplayObject, the target DisplayObject will get the current depth of the first. If target depth equals the current depth of DisplayObject, an assertion fails, as I think the caller should check this instead. |
References _, gnash::key::_1, gnash::DisplayObject::get_depth(), gnash::DisplayObject::getTarget(), IF_VERBOSE_ASCODING_ERRORS, gnash::log_aserror(), gnash::log_error(), gnash::DisplayObject::set_depth(), gnash::DisplayObject::set_invalidated(), gnash::DisplayObject::staticDepthOffset, and gnash::DisplayObject::transformedByScript().
Referenced by ~DisplayList().
|
inline |
Referenced by operator!=().
bool gnash::DisplayList::unload | ( | ) |
Unload the DisplayObjects in this DisplayList removing all but the ones with on onUnload event defined (checked by calling ::unload on them) and keeping the others, w/out depth-shifting them.
Return true if any child was kept (as they had onUnload defined)
References gnash::DisplayObject::destroy(), gnash::DisplayObject::isDestroyed(), and gnash::DisplayObject::unload().
Referenced by gnash::MovieClip::unloadChildren(), and ~DisplayList().
|
inline |
Visit each and all DisplayObject in the list.
Scan happens in arbitrary order, if order is important use visitBackward or visitForward
The visitor functor will receive a DisplayObject pointer, it's return value is not used so can return void.
NOTE: all elements in the list are visited, even the removed ones (unloaded) TODO: inspect if worth providing an arg to skip removed
Referenced by gnash::MovieClip::findDropTarget(), gnash::MovieClip::getBounds(), gnash::MovieClip::markOwnResources(), gnash::MovieClip::topmostMouseEntity(), gnash::MovieClip::visitNonProperties(), and ~DisplayList().
|
inline |
References DSOTEXPORT, and operator<<.
|
inline |
Visit each DisplayObject in the list in reverse depth order (higher depth first).
The visitor functor will receive a DisplayObject pointer; must return true if it wants next item or false to exit the loop.
NOTE: all elements in the list are visited, even the removed ones (unloaded) TODO: inspect if worth providing an arg to skip removed
Referenced by gnash::MovieClip::pointInHitableShape(), gnash::MovieClip::pointInShape(), gnash::MovieClip::pointInVisibleShape(), and ~DisplayList().
|
inline |
|
friend |
Output operator.
Referenced by visitAll(), and ~DisplayList().