[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-82-gf34e220 |
Date: |
Fri, 18 Feb 2011 10:44:44 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via f34e22064873c87fdca291af1737c49a1392c3b6 (commit)
via 3ca57f68aa4cb7fc35f0e06c645dddf49ff3b9da (commit)
via 4586c140f094ab4108abb814f3269f4256c42ecb (commit)
from 78619f0b6b11fcc4af9564f3179703ba12e46533 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=f34e22064873c87fdca291af1737c49a1392c3b6
commit f34e22064873c87fdca291af1737c49a1392c3b6
Author: Benjamin Wolsey <address@hidden>
Date: Fri Feb 18 11:13:13 2011 +0100
Const correct for readability.
diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index b6f1171..969d833 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -786,12 +786,7 @@ DisplayList::mergeDisplayList(DisplayList& newList)
iterator itNew = beginNonRemoved(newList._charsByDepth);
iterator itOldEnd = dlistTagsEffectiveZoneEnd(_charsByDepth);
-
- // There used to be an assertion here that no character in the new list
- // is at depth 65535 or higher. There's no reason why the tags executed
- // on the new list shouldn't do this though. Bug #29282 does this.
- // TODO: check whether we should be ignoring that character.
- iterator itNewEnd = dlistTagsEffectiveZoneEnd(newList._charsByDepth);
+ iterator itNewEnd = dlistTagsEffectiveZoneEnd(newList._charsByDepth);
// step1.
// starting scanning both lists.
@@ -800,13 +795,13 @@ DisplayList::mergeDisplayList(DisplayList& newList)
iterator itOldBackup = itOld;
DisplayObject* chOld = *itOldBackup;
- int depthOld = chOld->get_depth();
+ const int depthOld = chOld->get_depth();
while (itNew != itNewEnd) {
iterator itNewBackup = itNew;
DisplayObject* chNew = *itNewBackup;
- int depthNew = chNew->get_depth();
+ const int depthNew = chNew->get_depth();
// depth in old list is occupied, and empty in new list.
if (depthOld < depthNew) {
@@ -828,7 +823,7 @@ DisplayList::mergeDisplayList(DisplayList& newList)
++itOld;
++itNew;
- bool is_ratio_compatible =
+ const bool is_ratio_compatible =
(chOld->get_ratio() == chNew->get_ratio());
if (!is_ratio_compatible || chOld->isDynamic() ||
@@ -859,9 +854,9 @@ DisplayList::mergeDisplayList(DisplayList& newList)
}
// depth in old list is empty, but occupied in new list.
- ++ itNew;
+ ++itNew;
// add the new DisplayObject to the old list.
- _charsByDepth.insert(itOldBackup, *itNewBackup );
+ _charsByDepth.insert(itOldBackup, *itNewBackup);
}
// break if finish scanning the new list
@@ -871,7 +866,7 @@ DisplayList::mergeDisplayList(DisplayList& newList)
// step2(only required if scanning of new list finished earlier in step1).
// continue to scan the static zone of the old list.
// unload remaining DisplayObjects directly.
- while((itOld != itOldEnd) && ((*itOld)->get_depth() < 0)) {
+ while ((itOld != itOldEnd) && ((*itOld)->get_depth() < 0)) {
DisplayObject* chOld = *itOld;
itOld = _charsByDepth.erase(itOld);
@@ -891,7 +886,7 @@ DisplayList::mergeDisplayList(DisplayList& newList)
for (itNew = newList._charsByDepth.begin(); itNew != itNewEnd; ++itNew) {
DisplayObject* chNew = *itNew;
- int depthNew = chNew->get_depth();
+ const int depthNew = chNew->get_depth();
if (chNew->unloaded()) {
iterator it =
@@ -1011,8 +1006,7 @@ dlistTagsEffectiveZoneEnd(DisplayList::container_type& c)
std::ostream&
operator<<(std::ostream& os, const DisplayList& dl)
{
-
- if (dl._charsByDepth.empty()) return os;
+ if (dl._charsByDepth.empty()) return os << "Empty DisplayList";
os << "DisplayList size " << dl._charsByDepth.size() << "\n";
http://git.savannah.gnu.org/cgit//commit/?id=3ca57f68aa4cb7fc35f0e06c645dddf49ff3b9da
commit 3ca57f68aa4cb7fc35f0e06c645dddf49ff3b9da
Author: Benjamin Wolsey <address@hidden>
Date: Fri Feb 18 10:50:02 2011 +0100
Do not ignore objects at depth 65535 or the DisplayList
will lose track of them, allowing them to be deleted
without being removed from the list of live characters.
This was just a case of the wrong comparison being used.
Reduce the number of predicate functors.
diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index 29b023d..b6f1171 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -59,35 +59,29 @@ namespace {
/// Anonymous namespace for generic algorithm functors.
namespace {
-class DepthEquals
+struct DepthEquals : std::binary_function<const DisplayObject*, int, bool>
{
-public:
-
- DepthEquals(int depth) : _depth(depth) {}
-
- bool operator() (const DisplayObject* item) const {
+ bool operator()(const DisplayObject* item, int depth) const {
if (!item) return false;
- return item->get_depth() == _depth;
+ return item->get_depth() == depth;
}
-
-private:
- const int _depth;
};
-class DepthGreaterOrEqual
+struct DepthLessThan : std::binary_function<const DisplayObject*, int, bool>
{
-public:
-
- DepthGreaterOrEqual(int depth) : _depth(depth) {}
-
- bool operator() (const DisplayObject* item) const {
+ bool operator()(const DisplayObject* item, int depth) const {
if (!item) return false;
- return item->get_depth() >= _depth;
+ return item->get_depth() < depth;
}
-private:
- const int _depth;
};
+struct DepthGreaterThan : std::binary_function<const DisplayObject*, int, bool>
+{
+ bool operator()(const DisplayObject* item, int depth) const {
+ if (!item) return false;
+ return item->get_depth() > depth;
+ }
+};
class NameEquals
{
@@ -188,7 +182,7 @@ DisplayList::placeDisplayObject(DisplayObject* ch, int
depth)
container_type::iterator it =
std::find_if( _charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(depth));
+ boost::bind(std::not2(DepthLessThan()), _1, depth));
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
// add the new char
@@ -225,7 +219,7 @@ DisplayList::add(DisplayObject* ch, bool replace)
container_type::iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(depth));
+ boost::bind(std::not2(DepthLessThan()), _1, depth));
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
_charsByDepth.insert(it, ch);
@@ -249,7 +243,7 @@ DisplayList::replaceDisplayObject(DisplayObject* ch, int
depth,
container_type::iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(depth));
+ boost::bind(std::not2(DepthLessThan()), _1, depth));
if (it == _charsByDepth.end() || (*it)->get_depth() != depth) {
_charsByDepth.insert(it, ch);
@@ -350,7 +344,7 @@ DisplayList::removeDisplayObject(int depth)
// TODO: optimize to take by-depth order into account
container_type::iterator it =
std::find_if( _charsByDepth.begin(), _charsByDepth.end(),
- DepthEquals(depth));
+ boost::bind(DepthEquals(), _1, depth));
if (it != _charsByDepth.end()) {
// Make a copy (before erasing)
@@ -405,7 +399,7 @@ DisplayList::swapDepths(DisplayObject* ch1, int newdepth)
// upper bound ...
container_type::iterator it2 =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(newdepth));
+ boost::bind(std::not2(DepthLessThan()), _1, newdepth));
if (it1 == _charsByDepth.end()) {
log_error("First argument to DisplayList::swapDepth() "
@@ -457,7 +451,7 @@ DisplayList::removeDisplayObjectAt(int index)
{
container_type::iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthEquals(index));
+ boost::bind(DepthEquals(), _1, index));
if (it == _charsByDepth.end()) return 0;
@@ -490,7 +484,7 @@ DisplayList::insertDisplayObject(DisplayObject* obj, int
index)
// Find the first index greater than or equal to the required index
container_type::iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(index));
+ boost::bind(std::not2(DepthLessThan()), _1, index));
// Insert the DisplayObject before that position
_charsByDepth.insert(it, obj);
@@ -902,7 +896,7 @@ DisplayList::mergeDisplayList(DisplayList& newList)
if (chNew->unloaded()) {
iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(depthNew));
+ boost::bind(std::not2(DepthLessThan()), _1, depthNew));
_charsByDepth.insert(it, *itNew);
}
@@ -956,7 +950,7 @@ DisplayList::reinsertRemovedCharacter(DisplayObject* ch)
// TODO: optimize this by searching from the end(lowest depth).
container_type::iterator it =
std::find_if(_charsByDepth.begin(), _charsByDepth.end(),
- DepthGreaterOrEqual(newDepth));
+ boost::bind(std::not2(DepthLessThan()), _1, newDepth));
_charsByDepth.insert(it, ch);
@@ -990,7 +984,7 @@ beginNonRemoved(DisplayList::container_type& c)
const int depth = DisplayObject::removedDepthOffset -
DisplayObject::staticDepthOffset;
- return std::find_if(c.begin(), c.end(), DepthGreaterOrEqual(depth));
+ return std::find_if(c.begin(), c.end(),
boost::bind(std::not2(DepthLessThan()), _1, depth));
}
DisplayList::const_iterator
@@ -999,14 +993,16 @@ beginNonRemoved(const DisplayList::container_type& c)
const int depth = DisplayObject::removedDepthOffset -
DisplayObject::staticDepthOffset;
- return std::find_if(c.begin(), c.end(), DepthGreaterOrEqual(depth));
+ return std::find_if(c.begin(), c.end(),
+ boost::bind(std::not2(DepthLessThan()), _1, depth));
}
DisplayList::iterator
dlistTagsEffectiveZoneEnd(DisplayList::container_type& c)
{
return std::find_if(c.begin(), c.end(),
- DepthGreaterOrEqual(0xffff + DisplayObject::staticDepthOffset));
+ boost::bind(DepthGreaterThan(), _1,
+ 0xffff + DisplayObject::staticDepthOffset));
}
} // anonymous namespace
http://git.savannah.gnu.org/cgit//commit/?id=4586c140f094ab4108abb814f3269f4256c42ecb
commit 4586c140f094ab4108abb814f3269f4256c42ecb
Author: Benjamin Wolsey <address@hidden>
Date: Fri Feb 18 10:30:33 2011 +0100
Drop unused functors
diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index e9a2cff..29b023d 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -74,20 +74,6 @@ private:
const int _depth;
};
-struct DepthGreaterThan
-{
- bool operator()(const DisplayObject* a, const DisplayObject* b) const {
- return a->get_depth() > b->get_depth();
- }
-};
-
-struct DepthLessThan
-{
- bool operator()(const DisplayObject* a, const DisplayObject* b) const {
- return a->get_depth() < b->get_depth();
- }
-};
-
class DepthGreaterOrEqual
{
public:
-----------------------------------------------------------------------
Summary of changes:
libcore/DisplayList.cpp | 90 +++++++++++++++++-----------------------------
1 files changed, 33 insertions(+), 57 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-82-gf34e220,
Benjamin Wolsey <=