[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h... |
Date: |
Fri, 11 May 2007 07:02:01 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/05/11 07:02:01
Modified files:
. : ChangeLog
server : dlist.cpp dlist.h sprite_instance.cpp
sprite_instance.h
testsuite/misc-ming.all: displaylist_depths_test6.c
Log message:
* testsuite/misc-ming.all/displaylist_depths_test6.c:
Jump to frame 5, to avoid a failure and success of
the same test in two different points in time, and *stop*
there
(wiki updated).
* server/dlist.{cpp,h}: drop dangerous swap_characters, add
safe,
documented and correct swapDepths. (fixes
displaylist_depths_test6).
* server/sprite_instance.{cpp,h}: drop dangerous
swap_characters,
add safe and swapDepths proxy to DisplayList's.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3162&r2=1.3163
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.267&r2=1.268
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test6.c?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3162
retrieving revision 1.3163
diff -u -b -r1.3162 -r1.3163
--- ChangeLog 11 May 2007 05:03:47 -0000 1.3162
+++ ChangeLog 11 May 2007 07:02:00 -0000 1.3163
@@ -1,5 +1,16 @@
2007-05-11 Sandro Santilli <address@hidden>
+ * testsuite/misc-ming.all/displaylist_depths_test6.c:
+ Jump to frame 5, to avoid a failure and success of
+ the same test in two different points in time, and *stop* there
+ (wiki updated).
+ * server/dlist.{cpp,h}: drop dangerous swap_characters, add safe,
+ documented and correct swapDepths. (fixes displaylist_depths_test6).
+ * server/sprite_instance.{cpp,h}: drop dangerous swap_characters,
+ add safe and swapDepths proxy to DisplayList's.
+
+2007-05-11 Sandro Santilli <address@hidden>
+
* testsuite/misc-ming.all/Makefile.am: enabled
displaylist_depths_test6.swf runner
* testsuite/misc-ming.all/displaylist_depths_test6.c:
Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- server/dlist.cpp 18 Apr 2007 13:57:25 -0000 1.60
+++ server/dlist.cpp 11 May 2007 07:02:01 -0000 1.61
@@ -413,15 +413,71 @@
_characters.clear();
}
-void DisplayList::swap_characters(character* ch1, character* ch2)
+void
+DisplayList::swapDepths(character* ch1, int newdepth)
{
+
container_type::iterator it1 = find(_characters.begin(),
_characters.end(), ch1);
- container_type::iterator it2 = find(_characters.begin(),
_characters.end(), ch2);
- if (it1 != _characters.end() && it2 != _characters.end())
+ // upper bound ...
+ container_type::iterator it2 = find_if(_characters.begin(),
_characters.end(),
+ DepthGreaterOrEqual(newdepth));
+
+ if ( it1 == _characters.end() )
+ {
+ log_error("First argument to DisplayList::swapDepth() is NOT a
character in the list. Call ignored.");
+ return;
+ }
+
+ DisplayItem ch2 = *it2;
+
+ // Found another character at the given depth
+ if ( ch2->get_depth() == newdepth )
{
+ int srcdepth = ch1->get_depth();
+
+ ch2->set_depth(srcdepth);
+
+ // TODO: we're not actually invalidated ourselves, rather our
parent is...
+ // UdoG ? Want to verify this ?
+ ch2->set_invalidated();
+
+ // We won't accept static transforms after a depth swap.
+ // See displaylist_depths_test6.swf for more info.
+ ch2->transformedByScript();
+
iter_swap(it1, it2);
}
+
+ // No character found at the given depth
+ else
+ {
+ // Move the character to the new position
+ // NOTE: insert *before* erasing, in case the list is
+ // the only referer of the ref-counted character
+ _characters.insert(it2, ch1);
+ _characters.erase(it1);
+ }
+
+ // don't change depth before the iter_swap case above, as
+ // we'll need it to assign to the new character
+ ch1->set_depth(newdepth);
+
+ // TODO: we're not actually invalidated ourselves, rather our parent
is...
+ // UdoG ? Want to verify this ?
+ ch1->set_invalidated();
+
+ // We won't accept static transforms after a depth swap.
+ // See displaylist_depths_test6.swf for more info.
+ ch1->transformedByScript();
+
+#ifndef NDEBUG
+ // TODO: make this a testInvariant() method for DisplayList
+ DisplayList sorted = *this;
+ sorted.sort();
+ assert(*this == sorted); // check we didn't screw up ordering
+#endif
+
}
void DisplayList::clear_unaffected(std::vector<int>& affected_depths, bool
call_unload)
Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/dlist.h 18 Apr 2007 11:00:29 -0000 1.35
+++ server/dlist.h 11 May 2007 07:02:01 -0000 1.36
@@ -115,7 +115,28 @@
float ratio,
int clip_depth);
- void swap_characters(character* ch, character* ch2);
+ /// \brief
+ /// Change depth of the given characters in the list,
+ /// swapping with any existing character at target depth.
+ //
+ /// List ordering will be maintained by this function.
+ ///
+ /// Any character affected by this operation (none on invalid call,
+ /// 1 if new depth is not occupied, 2 otherwise) will be:
+ /// - bounds invalidated (see character::set_invalidated)
+ /// - marked as script-transformed (see
character::transformedByScript)
+ ///
+ /// @param ch
+ /// The character to apply depth swapping to.
+ /// If not found in the list, an error is raised
+ /// and no other action is taken.
+ ///
+ /// @param depth
+ /// The new depth to assign to the given character.
+ /// If occupied by another character, the target character
+ /// will get the current depth of the first.
+ ///
+ void swapDepths(character* ch, int depth);
/// Updates the transform properties of the object at
/// the specified depth.
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.267
retrieving revision 1.268
diff -u -b -r1.267 -r1.268
--- server/sprite_instance.cpp 10 May 2007 13:14:42 -0000 1.267
+++ server/sprite_instance.cpp 11 May 2007 07:02:01 -0000 1.268
@@ -269,7 +269,7 @@
return as_value(n);
}
-//swapDepths(target:Object) : Void
+//swapDepths(target:Object|target:Number) : Void
static as_value sprite_swap_depths(const fn_call& fn)
{
typedef boost::intrusive_ptr<sprite_instance> SpritePtr;
@@ -278,9 +278,6 @@
SpritePtr sprite = ensureType<sprite_instance>(fn.this_ptr);
int this_depth = sprite->get_depth();
- // Lower bound of source depth below which swapDepth has no effect
- static const int lowerDepthBound = -16384;
-
as_value rv;
if (fn.nargs < 1)
@@ -291,12 +288,13 @@
return rv;
}
- if ( this_depth < lowerDepthBound )
+ // Lower bound of source depth below which swapDepth has no effect
(below Timeline/static zone)
+ if ( this_depth < character::staticDepthOffset )
{
IF_VERBOSE_ASCODING_ERRORS(
stringstream ss; fn.dump_args(ss);
log_aserror(_("%s.swapDepths(%s): won't swap a clip below depth
%d (%d)"),
- sprite->getTarget().c_str(), ss.str().c_str(),
lowerDepthBound, this_depth);
+ sprite->getTarget().c_str(), ss.str().c_str(),
character::staticDepthOffset, this_depth);
);
return rv;
}
@@ -316,7 +314,7 @@
}
- CharPtr target = NULL;
+ //CharPtr target = NULL;
int target_depth = 0;
// sprite.swapDepth(sprite)
@@ -342,11 +340,12 @@
}
target_depth = target_sprite->get_depth();
- target = boost::dynamic_pointer_cast<character>(target_sprite);
+ //target =
boost::dynamic_pointer_cast<character>(target_sprite);
}
+
+ // sprite.swapDepth(depth)
else
{
- // sprite.swapDepth(depth)
double td = fn.arg(0).to_number(&(fn.env()));
if ( isnan(td) )
{
@@ -363,15 +362,11 @@
// TODO : check other kind of validities ?
target_depth = int(td);
- target = this_parent->get_character_at_depth(target_depth);
+ //target = this_parent->get_character_at_depth(target_depth);
}
- sprite->set_depth(target_depth);
- if ( target )
- {
- target->set_depth(this_depth);
- this_parent->swap_characters(sprite.get(), target.get());
- }
+ this_parent->swapDepths(sprite.get(), target_depth);
+
return rv;
}
@@ -2798,14 +2793,6 @@
do_display_callback();
}
-void sprite_instance::swap_characters(character* ch1, character* ch2)
-{
- ch1->set_invalidated();
- ch2->set_invalidated();
-
- m_display_list.swap_characters(ch1, ch2);
-}
-
bool
sprite_instance::attachCharacter(character& newch, int depth)
{
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- server/sprite_instance.h 11 May 2007 04:47:39 -0000 1.107
+++ server/sprite_instance.h 11 May 2007 07:02:01 -0000 1.108
@@ -314,7 +314,14 @@
/// Display (render?) this Sprite/MovieClip, unless invisible
void display();
- void swap_characters(character* ch1, character* ch2);
+ /// Swap depth of the given characters in the DisplayList
+ //
+ /// See DisplayList::swapDepths for more info
+ ///
+ void swapDepths(character* ch1, int newdepth)
+ {
+ m_display_list.swapDepths(ch1, newdepth);
+ }
/// Return the character at given depth in our DisplayList.
//
Index: testsuite/misc-ming.all/displaylist_depths_test6.c
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test6.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/displaylist_depths_test6.c 11 May 2007 05:03:47
-0000 1.4
+++ testsuite/misc-ming.all/displaylist_depths_test6.c 11 May 2007 07:02:01
-0000 1.5
@@ -27,7 +27,7 @@
*
* Frame | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
* --------+---+---+---+---+---+---+---+
- * Event | |PM | | T*| T | | J |
+ * Event | |PMM| | T | T*| | J |
*
* P = place (by PlaceObject2)
* T = transform matrix (by PlaceObject2)
@@ -41,7 +41,7 @@
* swap the character to depth -10, and then swap it back to -16381;
* frame4: try to transform the character to the right (50,200)
* frame5: try to transform the character to the right (200,200)
- * frame7: jump back to frame 4
+ * frame7: jump back to frame 5 and stop
*
* Expected behaviour:
*
@@ -134,43 +134,42 @@
SWFDisplayItem_moveTo(it1, 50, 200);
add_actions(mo,
// Immune to MOVE after swap, no matter if it swapped back to same depth
- "xcheck_equals(static3._x, 10);"
+ "check_equals(static3._x, 10);" // after loop back we fail ! :(
"check_equals(static3.getDepth(), -16381);"
);
SWFMovie_nextFrame(mo);
// Frame 5: move character at depth 3 to position 100,200
SWFDisplayItem_moveTo(it1, 200, 200);
+ SWFMovie_nextFrame(mo);
+
+ // Frame 6: nothing new, just tests
add_actions(mo,
// Immune to MOVE after swap, no matter if it swapped back to same depth
- "xcheck_equals(static3._x, 10);"
+ "check_equals(static3._x, 10);" // after loop back we fail ! :(
"check_equals(static3.getDepth(), -16381);"
);
SWFMovie_nextFrame(mo);
- // Frame 6: nothing new
- SWFMovie_nextFrame(mo);
-
// Frame 7: go to frame 4
add_actions(mo,
" if(loopback == false) "
" { "
// this does not reset any thing
- " gotoAndPlay(4); "
+ " gotoAndStop(5); "
" loopback = true; "
" } "
// Static3 refers to same instance
"xcheck_equals(static3.myThing, 'guess');" // gnash fails as it create a
new instance
// immune to MOVE after swap
- "xcheck_equals(static3._x, 10);"
+ "xcheck_equals(static3._x, 10);" // gnash created a new instance instead..
+
"check_equals(static3.getDepth(), -16381);"
+ "totals();"
);
SWFMovie_nextFrame(mo);
- add_actions(mo, "totals(); stop();");
- SWFMovie_nextFrame(mo);
-
//Output movie
puts("Saving " OUTPUT_FILENAME );
SWFMovie_save(mo, OUTPUT_FILENAME);
- [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...,
Sandro Santilli <=