gnash-commit
[Top][All Lists]
Advanced

[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:35:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/11 07:35:11

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp dlist.h sprite_instance.cpp 
        testsuite/misc-ming.all: Makefile.am 
Added files:
        testsuite/misc-ming.all: displaylist_depths_test7.c 

Log message:
                * server/dlist.{cpp,h} (swapDepths): abort if target depth
                  equals depth of source character.
                * server/sprite_instance.cpp (sprite_swap_depths): raise
                  a debugging message and skip any depths swap if target depth
                  equals depth of source character.
                * testsuite/misc-ming.all/: Makefile.am, 
displaylist_depths_test7.c:
                  New scenario testing that swapDepth(currentdepth) has no 
effect.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3163&r2=1.3164
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.268&r2=1.269
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test7.c?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3163
retrieving revision 1.3164
diff -u -b -r1.3163 -r1.3164
--- ChangeLog   11 May 2007 07:02:00 -0000      1.3163
+++ ChangeLog   11 May 2007 07:35:11 -0000      1.3164
@@ -1,5 +1,15 @@
 2007-05-11 Sandro Santilli <address@hidden>
 
+       * server/dlist.{cpp,h} (swapDepths): abort if target depth
+         equals depth of source character.
+       * server/sprite_instance.cpp (sprite_swap_depths): raise
+         a debugging message and skip any depths swap if target depth
+         equals depth of source character.
+       * testsuite/misc-ming.all/: Makefile.am, displaylist_depths_test7.c:
+         New scenario testing that swapDepth(currentdepth) has no effect.
+
+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

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/dlist.cpp    11 May 2007 07:02:01 -0000      1.61
+++ server/dlist.cpp    11 May 2007 07:35:11 -0000      1.62
@@ -417,6 +417,8 @@
 DisplayList::swapDepths(character* ch1, int newdepth)
 {
 
+       assert(ch1->get_depth() != newdepth);
+
        container_type::iterator it1 = find(_characters.begin(), 
_characters.end(), ch1);
 
        // upper bound ...

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- server/dlist.h      11 May 2007 07:02:01 -0000      1.36
+++ server/dlist.h      11 May 2007 07:35:11 -0000      1.37
@@ -135,6 +135,8 @@
        ///     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.
+       ///     If target depth equals the current depth of character, an
+       ///     assertion fails, as I think the caller should check this 
instead.
        ///
        void swapDepths(character* ch, int depth);
 

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -b -r1.268 -r1.269
--- server/sprite_instance.cpp  11 May 2007 07:02:01 -0000      1.268
+++ server/sprite_instance.cpp  11 May 2007 07:35:11 -0000      1.269
@@ -359,10 +359,27 @@
                        return rv;
                }
 
+               target_depth = int(td);
+
+               // Check we're not swapping the our own depth so
+               // to avoid unecessary bounds invalidation and immunizing
+               // the instance from subsequent PlaceObjec tags attempting
+               // to transform it.
+               if ( sprite->get_depth() == target_depth )
+               {
+                       IF_VERBOSE_ASCODING_ERRORS(
+                       stringstream ss; fn.dump_args(ss);
+                       log_aserror(_("%s.swapDepths(%s): ignored, character 
already at depth %d"),
+                               sprite->getTarget().c_str(),
+                               ss.str().c_str(), target_depth);
+                       );
+                       return rv;
+               }
+
+
                // TODO : check other kind of validities ?
 
-               target_depth = int(td);
-               //target = this_parent->get_character_at_depth(target_depth);
+
        }
 
        this_parent->swapDepths(sprite.get(), target_depth);

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- testsuite/misc-ming.all/Makefile.am 11 May 2007 05:03:47 -0000      1.110
+++ testsuite/misc-ming.all/Makefile.am 11 May 2007 07:35:11 -0000      1.111
@@ -84,6 +84,7 @@
        displaylist_depths_test4 \
        displaylist_depths_test5 \
        displaylist_depths_test6 \
+       displaylist_depths_test7 \
        masks_test \
        attachMovieTest \
        attachMovieTestRunner \
@@ -165,6 +166,7 @@
        displaylist_depths_test4runner \
        displaylist_depths_test5runner \
        displaylist_depths_test6runner \
+       displaylist_depths_test7runner \
        get_frame_number_testrunner \
        frame_label_testrunner \
        path_format_testrunner \
@@ -501,6 +503,20 @@
        sh $< -f20 $(top_builddir) displaylist_depths_test6.swf > $@
        chmod 755 $@
 
+displaylist_depths_test7_SOURCES =     \
+       displaylist_depths_test7.c      \
+       ming_utils.h            \
+       ming_utils.c            \
+       $(NULL)
+displaylist_depths_test7_LDADD = $(MING_LIBS)
+
+displaylist_depths_test7.swf: displaylist_depths_test7
+       ./displaylist_depths_test7 $(top_srcdir)/testsuite/media
+
+displaylist_depths_test7runner: $(srcdir)/../generic-testrunner.sh 
displaylist_depths_test7.swf
+       sh $< -f20 $(top_builddir) displaylist_depths_test7.swf > $@
+       chmod 755 $@
+
 masks_test_SOURCES =   \
        masks_test.c    \
        ming_utils.h            \
@@ -1208,6 +1224,7 @@
        displaylist_depths_test4runner \
        displaylist_depths_test5runner \
        displaylist_depths_test6runner \
+       displaylist_depths_test7runner \
        matrix_testrunner \
        get_frame_number_testrunner \
        frame_label_testrunner \

Index: testsuite/misc-ming.all/displaylist_depths_test7.c
===================================================================
RCS file: testsuite/misc-ming.all/displaylist_depths_test7.c
diff -N testsuite/misc-ming.all/displaylist_depths_test7.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/displaylist_depths_test7.c  11 May 2007 07:35:11 
-0000      1.1
@@ -0,0 +1,172 @@
+/* 
+ *   Copyright (C) 2007 Free Software Foundation, Inc.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */ 
+
+/*
+ * Zou Lunkai, address@hidden
+ *
+ * Test how swapDepth affects DisplayList refresh on gotoAndPlay(current-X).
+ *
+ * run as ./displaylist_depths_test7
+ *
+ * Timeline:
+ * 
+ *   Frame  | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+ *  --------+---+---+---+---+---+---+---+
+ *   Event  |   |PM |   | T | T*|   | J |
+ * 
+ *  P = place (by PlaceObject2)
+ *  T = transform matrix (by PlaceObject2)
+ *  M = move to another (or same) depth (by swapDepth)
+ *  J = jump
+ *  * = jump target
+ * 
+ * Description:
+ * 
+ *  frame2: character placed at depth -16381 at position (10,200);
+ *          swap the character to depth -16381 (YES: SAME DEPTH!)
+ *  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 5 and stop
+ * 
+ * Expected behaviour:
+ * 
+ *  Depth swapping in frame2 have NO effect. In particular doesn't prevent 
subsequent static transformations to apply.
+ *  Before the jump we have a single instance at depth -16381 and position 
10,200.
+ *  After the jump we have the same instances at depth -16381, and still 
positioned at 10,200.
+ *  A single instance has been constructed in total.
+ *   
+ */
+
+#include "ming_utils.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "displaylist_depths_test7.swf"
+
+SWFDisplayItem add_static_mc(SWFMovie mo, const char* name, int depth, int x, 
int y, int width, int height);
+
+SWFDisplayItem
+add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int 
width, int height)
+{
+  SWFShape sh;
+  SWFMovieClip mc, mc2;
+  SWFDisplayItem it;
+
+  sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 
255, 0, 0);
+  mc = newSWFMovieClip();
+  SWFMovieClip_add(mc, (SWFBlock)sh);
+
+  SWFMovieClip_nextFrame(mc);
+
+  it = SWFMovie_add(mo, (SWFBlock)mc);
+  SWFDisplayItem_setDepth(it, depth); 
+  SWFDisplayItem_moveTo(it, x, y); 
+  SWFDisplayItem_setName(it, name);
+
+  return it;
+}
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip dejagnuclip;
+  int i;
+  SWFDisplayItem it1;
+
+
+  const char *srcdir=".";
+  if ( argc>1 ) 
+    srcdir=argv[1];
+  else
+  {
+      //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+      //return 1;
+  }
+
+  Ming_init();
+  mo = newSWFMovieWithVersion(OUTPUT_VERSION);
+  SWFMovie_setDimension(mo, 800, 600);
+  SWFMovie_setRate (mo, 2);
+
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  add_actions(mo, "loopback = false;");
+  SWFMovie_nextFrame(mo); 
+
+  // Frame 2: Add a static movieclip at depth 3 with origin at 10,200, swap to 
depth -10 and swap back
+  it1 = add_static_mc(mo, "static3", 3, 10, 200, 20, 20);
+  add_actions(mo,
+    "static3.myThing = 'guess';"
+    "check_equals(static3.getDepth(), -16381);" 
+    // swap to another depth
+    "static3.swapDepths(-16381);"    
+    "check_equals(static3.getDepth(), -16381);" 
+    );
+  SWFMovie_nextFrame(mo); 
+
+  // Frame 3: nothing new
+  SWFMovie_nextFrame(mo); 
+
+  // Frame 4: move character at depth 3 to position 50,200
+  SWFDisplayItem_moveTo(it1, 50, 200); 
+  add_actions(mo,
+    "check_equals(static3._x, 50);" 
+    "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,
+    "check_equals(static3._x, 200);"  
+    "check_equals(static3.getDepth(), -16381);" 
+    );
+  SWFMovie_nextFrame(mo); 
+
+  // Frame 7: go to frame 4 
+  add_actions(mo,
+    " if(loopback == false) "
+    " { "
+    // this does not reset any thing
+    "   gotoAndStop(4); "
+    "   loopback = true; "
+    " } "
+    
+    // Static3 refers to same instance
+    "xcheck_equals(static3.myThing, 'guess');" // gnash fails as it create a 
new instance
+    "check_equals(static3._x, 200);" // this succeeds by accident (the new 
instance is in the same position where the old should be)
+
+    "check_equals(static3.getDepth(), -16381);" 
+    "totals();"
+    );
+  SWFMovie_nextFrame(mo); 
+
+  //Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]