[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12275: Cleanups only: drop duplicat
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12275: Cleanups only: drop duplicated function. Drop DisplayItem typedef. Add some |
Date: |
Fri, 25 Jun 2010 21:21:45 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12275 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2010-06-25 21:21:45 +0200
message:
Cleanups only: drop duplicated function. Drop DisplayItem typedef. Add some
assertions to help DisplayList cleanup. Drop unnecessary check in as_value.
modified:
libcore/DisplayList.cpp
libcore/DisplayList.h
libcore/DisplayObject.cpp
libcore/DisplayObject.h
libcore/as_value.cpp
=== modified file 'libcore/DisplayList.cpp'
--- a/libcore/DisplayList.cpp 2010-06-23 06:12:47 +0000
+++ b/libcore/DisplayList.cpp 2010-06-25 17:51:25 +0000
@@ -65,7 +65,7 @@
DepthEquals(int depth) : _depth(depth) {}
- bool operator() (const DisplayItem& item) {
+ bool operator() (const DisplayObject* item) {
if (!item) return false;
return item->get_depth() == _depth;
}
@@ -76,14 +76,14 @@
struct DepthGreaterThan
{
- bool operator()(const DisplayItem& a, const DisplayItem& b) {
+ bool operator()(const DisplayObject* a, const DisplayObject* b) {
return a->get_depth() > b->get_depth();
}
};
struct DepthLessThan
{
- bool operator()(const DisplayItem& a, const DisplayItem& b) {
+ bool operator()(const DisplayObject* a, const DisplayObject* b) {
return a->get_depth() < b->get_depth();
}
};
@@ -94,7 +94,7 @@
DepthGreaterOrEqual(int depth) : _depth(depth) {}
- bool operator() (const DisplayItem& item) {
+ bool operator() (const DisplayObject* item) {
if (!item) return false;
return item->get_depth() >= _depth;
}
@@ -108,7 +108,7 @@
public:
NameEquals(const std::string& name) : _name(name) {}
- bool operator() (const DisplayItem& item) {
+ bool operator() (const DisplayObject* item) {
assert (item);
// TODO: this is necessary because destroy() is called in
// movie_root, leaving destroyed items on the DisplayList. They
@@ -129,7 +129,7 @@
public:
NameEqualsNoCase(const std::string& name) : _name(name) {}
- bool operator() (const DisplayItem& item) {
+ bool operator() (const DisplayObject* item) {
assert (item);
// TODO: this is necessary because destroy() is called in
// movie_root, leaving destroyed items on the DisplayList. They
@@ -176,6 +176,9 @@
DisplayObject* ch = *it;
+ // Should not be there!
+ if (ch->isDestroyed()) continue;
+
// found
if (ch->get_depth() == depth) return ch;
@@ -232,7 +235,7 @@
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
// add the new char
- _charsByDepth.insert(it, DisplayItem(ch));
+ _charsByDepth.insert(it, ch);
}
else {
// remember bounds of old char
@@ -243,7 +246,7 @@
DisplayObject* oldCh = *it;
// replace existing char (before calling unload!)
- *it = DisplayItem(ch);
+ *it = ch;
if (oldCh->unload()) {
// reinsert removed DisplayObject if needed
@@ -268,9 +271,9 @@
DepthGreaterOrEqual(depth));
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
- _charsByDepth.insert(it, DisplayItem(ch));
+ _charsByDepth.insert(it, ch);
}
- else if (replace) *it = DisplayItem(ch);
+ else if (replace) *it = ch;
testInvariant();
}
@@ -291,10 +294,8 @@
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
DepthGreaterOrEqual(depth));
- DisplayItem di(ch);
-
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
- _charsByDepth.insert(it, di);
+ _charsByDepth.insert(it, ch);
}
else {
// Make a copy (before replacing)
@@ -316,7 +317,7 @@
oldch->add_invalidated_bounds(old_ranges, true);
// replace existing char (before calling unload)
- *it = di;
+ *it = ch;
// Unload old char
if (oldch->unload()) {
@@ -460,7 +461,7 @@
// Found another DisplayObject at the given depth
if (it2 != _charsByDepth.end() && (*it2)->get_depth() == newdepth)
{
- DisplayItem ch2 = *it2;
+ DisplayObject* ch2 = *it2;
ch2->set_depth(srcdepth);
@@ -598,7 +599,10 @@
itEnd = _charsByDepth.end(); it != itEnd; )
{
// make a copy
- DisplayItem di = *it;
+ DisplayObject* di = *it;
+
+ // Destroyed objects should not be there!
+ assert(!di->isDestroyed());
// Destroy those with a handler anyway?
if (di->unload()) {
@@ -633,7 +637,7 @@
it != itEnd; ) {
// make a copy
- DisplayItem di = *it;
+ DisplayObject* di = *it;
// skip if already unloaded
if ( di->isDestroyed() ) {
@@ -662,6 +666,7 @@
for (iterator endIt = _charsByDepth.end(); it != endIt; ++it)
{
DisplayObject* ch = *it;
+ assert(!ch->isDestroyed());
DisplayObject* mask = ch->getMask();
if (mask && ch->visible() && ! mask->unloaded())
@@ -754,7 +759,7 @@
for (const_iterator it = _charsByDepth.begin(),
endIt = _charsByDepth.end(); it != endIt; ++it) {
- const DisplayItem& dobj = *it;
+ const DisplayObject* dobj = *it;
log_debug(_("Item %d(%s) at depth %d (char name %s, type %s)"
"Destroyed: %s, unloaded: %s"),
num, dobj, dobj->get_depth(), dobj->get_name(), typeName(*dobj),
@@ -799,7 +804,7 @@
iterator it = beginNonRemoved(_charsByDepth);
for (iterator endIt = _charsByDepth.end(); it != endIt; ++it) {
- DisplayItem& dobj = *it;
+ DisplayObject* dobj = *it;
#ifndef GNASH_USE_GC
assert(dobj->get_ref_count() > 0);
@@ -1056,6 +1061,7 @@
DisplayList::reinsertRemovedCharacter(DisplayObject* ch)
{
assert(ch->unloaded());
+ assert(!ch->isDestroyed());
testInvariant();
// TODO: have this done by DisplayObject::unload() instead ?
@@ -1068,7 +1074,7 @@
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
DepthGreaterOrEqual(newDepth));
- _charsByDepth.insert(it, DisplayItem(ch));
+ _charsByDepth.insert(it, ch);
testInvariant();
}
@@ -1144,7 +1150,7 @@
for (DisplayList::const_iterator it = dl._charsByDepth.begin(),
itEnd = dl._charsByDepth.end(); it != itEnd; ++it) {
- const DisplayItem& item = *it;
+ const DisplayObject* item = *it;
if (it != dl._charsByDepth.begin()) os << " | ";
os << " name:" << item->get_name()
<< " depth:" << item->get_depth();
=== modified file 'libcore/DisplayList.h'
--- a/libcore/DisplayList.h 2010-06-23 06:12:47 +0000
+++ b/libcore/DisplayList.h 2010-06-25 17:51:25 +0000
@@ -47,9 +47,6 @@
namespace gnash {
-/// A DisplayItem is simply a DisplayObject object
-typedef DisplayObject* DisplayItem;
-
/// A list of on-stage DisplayObjects, ordered by depth
//
/// Any MovieClip has an associated DisplayList
@@ -62,7 +59,7 @@
public:
- typedef std::list<DisplayItem> container_type;
+ 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;
@@ -411,9 +408,7 @@
{
for (iterator it = _charsByDepth.begin(), itEnd = _charsByDepth.end();
it != itEnd; ++it) {
-
- DisplayItem& di = *it;
- if (!visitor(di)) break;
+ if (!visitor(*it)) break;
}
}
@@ -423,9 +418,7 @@
{
for (reverse_iterator it = _charsByDepth.rbegin(),
itEnd = _charsByDepth.rend(); it != itEnd; ++it) {
-
- DisplayItem& di = *it;
- if (!visitor(di)) break;
+ if (!visitor(*it)) break;
}
}
@@ -435,9 +428,7 @@
{
for (const_reverse_iterator it = _charsByDepth.rbegin(),
itEnd = _charsByDepth.rend(); it != itEnd; ++it) {
-
- const DisplayItem& di = *it;
- if (!visitor(di)) break;
+ if (!visitor(*it)) break;
}
}
=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2010-06-18 12:26:04 +0000
+++ b/libcore/DisplayObject.cpp 2010-06-25 18:21:57 +0000
@@ -611,11 +611,10 @@
}
-/*private*/
+/*public*/
std::string
-DisplayObject::computeTargetPath() const
+DisplayObject::getTargetPath() const
{
-
// TODO: check what happens when this DisplayObject
// is a Movie loaded into another
// running movie.
@@ -664,13 +663,6 @@
return target;
}
-/*public*/
-std::string
-DisplayObject::getTargetPath() const
-{
- return computeTargetPath();
-}
-
/*public*/
std::string
=== modified file 'libcore/DisplayObject.h'
--- a/libcore/DisplayObject.h 2010-06-18 12:26:04 +0000
+++ b/libcore/DisplayObject.h 2010-06-25 18:21:57 +0000
@@ -1046,9 +1046,6 @@
/// Register a DisplayObject masked by this instance
void setMaskee(DisplayObject* maskee);
- /// Build the _target member recursive on parent
- std::string computeTargetPath() const;
-
/// The as_object to which this DisplayObject is attached.
as_object* _object;
=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp 2010-06-21 11:02:50 +0000
+++ b/libcore/as_value.cpp 2010-06-25 18:00:16 +0000
@@ -234,12 +234,9 @@
// reference player.
if (ret.is_string()) return ret.getStr();
}
- catch (ActionTypeError& e) {
- }
-
- if (_type == OBJECT) {
- return is_function() ? "[type Function]" : "[type Object]";
- }
+ catch (ActionTypeError& e) {}
+
+ return is_function() ? "[type Function]" : "[type Object]";
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12275: Cleanups only: drop duplicated function. Drop DisplayItem typedef. Add some,
Benjamin Wolsey <=