gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog server/dlist.h server/sprite_in...


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/dlist.h server/sprite_in...
Date: Thu, 12 Apr 2007 14:32:12 +0800

+       // TODO: FIXME: this whole thing is bogus,
+       //       we should extract the actual bounds
+       //       and return their height

I don't think so.  the "_height" property has nothing to do with the
"bound" returned by getBounds() method.   We can read and set
"_height", but only read "bound". Reset the "_height" property will
not reset the "bound".

On 4/12/07, Sandro Santilli <address@hidden> wrote:
CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/12 05:37:33

Modified files:
       .              : ChangeLog
       server         : dlist.h sprite_instance.cpp
       server/parser  : shape_character_def.cpp
       testsuite/actionscript.all: MovieClip.as
       testsuite/misc-ming.all: displaylist_depths_test.c

Log message:
               * server/parser/shape_character_def.cpp (compute_bound):
                 skip anchor point of empty paths; include both control
                 and anchor point of any edge.
               * server/dlist.h: add a visitAll() method for unconditional
                 full scan.
               * server/sprite_instance.cpp: optimize WidthFinder, HeightFinder,
                 ScriptObjectFinder and CharacterExtractor to return void
                 (can be used by visitAll); (get_width, get_height): include
                 scan of DrawingAPI canvas.
               * testsuite/actionscript.all/MovieClip.as,
                 testsuite/misc-ming.all/displaylist_depths_test.c:
                 few more successes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2853&r2=1.2854
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.233&r2=1.234
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test.c?cvsroot=gnash&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2853
retrieving revision 1.2854
diff -u -b -r1.2853 -r1.2854
--- ChangeLog   11 Apr 2007 17:54:21 -0000      1.2853
+++ ChangeLog   12 Apr 2007 05:37:33 -0000      1.2854
@@ -1,3 +1,18 @@
+2007-04-11 Sandro Santilli <address@hidden>
+
+       * server/parser/shape_character_def.cpp (compute_bound):
+         skip anchor point of empty paths; include both control
+         and anchor point of any edge.
+       * server/dlist.h: add a visitAll() method for unconditional
+         full scan.
+       * server/sprite_instance.cpp: optimize WidthFinder, HeightFinder,
+         ScriptObjectFinder and CharacterExtractor to return void
+         (can be used by visitAll); (get_width, get_height): include
+         scan of DrawingAPI canvas.
+       * testsuite/actionscript.all/MovieClip.as,
+         testsuite/misc-ming.all/displaylist_depths_test.c:
+         few more successes.
+
 2007-04-11 Ann Barcomb <address@hidden>

       * devtools/lib/Gnash/Distribution.pm: made it more

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/dlist.h      11 Apr 2007 14:20:20 -0000      1.33
+++ server/dlist.h      12 Apr 2007 05:37:33 -0000      1.34
@@ -269,6 +269,17 @@
       template <class V>
       inline void visitBackward(V& visitor);

+       /// \brief
+       /// Visit each and all character in the list.
+       //
+       /// Scan happens in arbitrary order, if order is
+       /// important use visitBackward or visitForward
+       ///
+       /// The visitor functor will receive a character pointer,
+       /// it's return value is not used so can return void.
+       template <class V>
+       inline void visitAll(V& visitor);
+
       /// dump list to given output stream (debugging)
       void dump(std::ostream& os) const;

@@ -353,6 +364,18 @@
       }
 }

+template <class V>
+void
+DisplayList::visitAll(V& visitor)
+{
+       for (iterator it = _characters.begin(),
+                       itEnd = _characters.end();
+               it != itEnd; ++it)
+       {
+               visitor(it->get());
+       }
+}
+
 std::ostream& operator<< (std::ostream&, const DisplayList&);

 } // namespace gnash

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -b -r1.233 -r1.234
--- server/sprite_instance.cpp  11 Apr 2007 17:54:21 -0000      1.233
+++ server/sprite_instance.cpp  12 Apr 2007 05:37:33 -0000      1.234
@@ -25,7 +25,6 @@

 #include "log.h"
 #include "action.h" // for call_method_parsed (call_method_args)
-//#include "gnash.h"
 #include "render.h"  // for bounds_in_clipping_area()
 #include "sprite_instance.h"
 #include "movie_definition.h"
@@ -1422,13 +1421,12 @@
 public:
       float _h;
       HeightFinder(): _h(0) {}
-       bool operator() (character* ch)
+       void operator() (character* ch)
       {
               float ch_h = ch->get_height();
               if (ch_h > _h) {
                       _h = ch_h;
               }
-               return true; // keep scanning
       }
       float getHeight() {
               return _h;
@@ -1444,13 +1442,12 @@
 public:
       float _w;
       WidthFinder(): _w(0) {}
-       bool operator() (character* ch)
+       void operator() (character* ch)
       {
               float ch_w = ch->get_width();
               if (ch_w > _w) {
                       _w = ch_w;
               }
-               return true; // keep scanning
       }
       float getWidth() {
               return _w;
@@ -1473,7 +1470,7 @@
               _staticChars(staticChars)
       {}

-       bool operator() (character* ch)
+       void operator() (character* ch)
       {
               // TODO: Are script-transformed object to be kept ?
               //       Need a testcase for this
@@ -1488,7 +1485,6 @@
               {
                       _staticChars.push_back(ch);
               }
-               return true; // keep scanning
       }
 };

@@ -1505,10 +1501,9 @@
               _chars(chars)
       {}

-       bool operator() (character* ch)
+       void operator() (character* ch)
       {
               _chars.push_back(ch);
-               return true; // keep scanning
       }
 };

@@ -2271,7 +2266,7 @@
       std::vector<character*> charsToAdd;
       std::vector<character*> charsToKeep;
       ScriptObjectsFinder scriptObjFinder(charsToAdd, charsToKeep);
-       m_display_list.visitForward(scriptObjFinder);
+       m_display_list.visitAll(scriptObjFinder);

       // Resort frame0 DisplayList as depth of
       // characters in it might have been
@@ -2410,7 +2405,7 @@
 sprite_instance::find_previous_replace_or_add_tag(int frame,
               int depth, int id)
 {
-       uint32_t depth_id = ((depth & 0x0FFFF) << 16) | (id & 0x0FFFF);
+       uint32 depth_id = ((depth & 0x0FFFF) << 16) | (id & 0x0FFFF);

       for (int f = frame - 1; f >= 0; f--)
       {
@@ -2952,22 +2947,36 @@

 float sprite_instance::get_height() const
 {
+       // TODO: FIXME: this whole thing is bogus,
+       //       we should extract the actual bounds
+       //       and return their height
+
       HeightFinder f;
       // the const_cast is just to avoid defining a const version
       // of DisplayList::visitForward, HeightFinder will NOT
       // modify the DisplayList elements in any way
-       const_cast<DisplayList&>(m_display_list).visitForward(f);
-       return f.getHeight();
+       const_cast<DisplayList&>(m_display_list).visitAll(f);
+       float h = f.getHeight();
+       float hd = _drawable->get_height_local();
+       if ( hd > h ) h = hd;
+       return h;
 }

 float sprite_instance::get_width() const
 {
+       // TODO: FIXME: this whole thing is bogus,
+       //       we should extract the actual bounds
+       //       and return their width
+
       WidthFinder f;
       // the const_cast is just to avoid defining a const version
       // of DisplayList::visitForward, WidthFinder will NOT
       // modify the DisplayList elements in any way
-       const_cast<DisplayList&>(m_display_list).visitForward(f);
-       return f.getWidth();
+       const_cast<DisplayList&>(m_display_list).visitAll(f);
+       float w = f.getWidth();
+       float wd = _drawable->get_width_local();
+       if ( wd > w ) w = wd;
+       return w;
 }

 character*

Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/parser/shape_character_def.cpp       10 Apr 2007 03:12:04 -0000      
1.14
+++ server/parser/shape_character_def.cpp       12 Apr 2007 05:37:33 -0000      
1.15
@@ -6,7 +6,7 @@
 // Quadratic bezier outline shapes, the basis for most SWF rendering.


-/* $Id: shape_character_def.cpp,v 1.14 2007/04/10 03:12:04 zoulunkai Exp $ */
+/* $Id: shape_character_def.cpp,v 1.15 2007/04/12 05:37:33 strk Exp $ */

 #include "shape_character_def.h"

@@ -621,12 +621,16 @@
 {
       r->set_null();

-    for (unsigned int i = 0; i < m_paths.size(); i++) {
+    for (unsigned int i = 0; i < m_paths.size(); i++)
+    {
       const path&     p = m_paths[i];
+       size_t nedges = p.m_edges.size();
+       if ( ! nedges ) continue;
       r->expand_to_point(p.m_ax, p.m_ay);
-       for (unsigned int j = 0; j < p.m_edges.size(); j++)     {
+       for (unsigned int j = 0; j<nedges; j++)
+       {
           r->expand_to_point(p.m_edges[j].m_ax, p.m_edges[j].m_ay);
-//                                     r->expand_to_point(p.m_edges[j].m_cx, 
p.m_edges[j].m_cy);
+               r->expand_to_point(p.m_edges[j].m_cx, p.m_edges[j].m_cy);
       }
    }
 }

Index: testsuite/actionscript.all/MovieClip.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- testsuite/actionscript.all/MovieClip.as     11 Apr 2007 17:10:12 -0000      
1.52
+++ testsuite/actionscript.all/MovieClip.as     12 Apr 2007 05:37:33 -0000      
1.53
@@ -22,7 +22,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf

-rcsid="$Id: MovieClip.as,v 1.52 2007/04/11 17:10:12 strk Exp $";
+rcsid="$Id: MovieClip.as,v 1.53 2007/04/12 05:37:33 strk Exp $";

 #include "check.as"

@@ -60,23 +60,6 @@
 check(mc.globalToLocal);
 check_equals(typeOf(mc.unloadMovie), 'function');

-
-//
-// Test getBounds (simple test)
-//
-var bounds = mc.getBounds();
-check_equals(typeof(bounds), "object");
-// Checking for real values would be a bit hard
-// atm, as the loaded Dejagnu.swf file might
-// write stuff all around thus making bounds
-// change often... we'll check it later, with
-// a user defined movieclip (more control over
-// it's bounds)
-check(bounds.xMin != undefined);
-check(bounds.yMin != undefined);
-check(bounds.xMax != undefined);
-check(bounds.yMax != undefined);
-
 // This seems unavailable
 // when targetting SWF > 6
 #if OUTPUT_VERSION > 6
@@ -539,6 +522,7 @@
 check_equals(typeof(b.xMax), 'number');
 check_equals(typeof(b.yMin), 'number');
 check_equals(typeof(b.yMax), 'number');
+// Returned number is (2^28/2)-1 twips : any ringing bell ?
 xcheck_equals(b.xMin, 6710886.35);
 xcheck_equals(b.xMax, 6710886.35);
 xcheck_equals(b.yMin, 6710886.35);
@@ -553,8 +537,8 @@
       lineTo(20, 10);
       lineTo(10, 10);
 }
-xcheck_equals(draw._width, 10);
-xcheck_equals(draw._height, 20);
+check_equals(draw._width, 10);
+check_equals(draw._height, 20);
 b = draw.getBounds();
 xcheck_equals(b.xMin, 10);
 xcheck_equals(b.xMax, 20);
@@ -581,25 +565,25 @@

 draw._xscale = 200;
 xcheck_equals(draw._width, 20);
-xcheck_equals(draw._height, 20);
+check_equals(draw._height, 20);

 draw._rotation = 0;
 xcheck_equals(draw._width, 20);
-xcheck_equals(draw._height, 20);
+check_equals(draw._height, 20);

 draw._visible = true;
 draw._xscale = 100;
-xcheck_equals(draw._width, 10);
-xcheck_equals(draw._height, 20);
+check_equals(draw._width, 10);
+check_equals(draw._height, 20);

 draw._yscale = 50;
-xcheck_equals(draw._width, 10);
+check_equals(draw._width, 10);
 xcheck_equals(draw._height, 10);
-xcheck_equals(container._width, 10);
+check_equals(container._width, 10);
 xcheck_equals(container._height, 10);

 container._xscale = 800;
-xcheck_equals(draw._width, 10);
+check_equals(draw._width, 10);
 xcheck_equals(draw._height, 10);
 xcheck_equals(container._width, 80);
 xcheck_equals(container._height, 10);

Index: testsuite/misc-ming.all/displaylist_depths_test.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/misc-ming.all/displaylist_depths_test.c   11 Apr 2007 14:20:21 
-0000      1.5
+++ testsuite/misc-ming.all/displaylist_depths_test.c   12 Apr 2007 05:37:33 
-0000      1.6
@@ -235,40 +235,40 @@
       check_equals(mo, "typeof(staticmc_dup.child)", "'movieclip'");

       // Note that dynamicmc_dup is at negative depth
-       check_equals(mo, "dynamicmc_dup._width", "dynamicmc._width");
+       xcheck_equals(mo, "dynamicmc_dup._width", "dynamicmc._width");
       xcheck_equals(mo, "parseInt(dynamicmc_dup._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc_dup.child)", "'undefined'");

-       check_equals(mo, "dynamicmc_2000_dup._width", "dynamicmc_2000._width");
+       xcheck_equals(mo, "dynamicmc_2000_dup._width", "dynamicmc_2000._width");
       xcheck_equals(mo, "parseInt(dynamicmc_2000_dup._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc_2000.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc_2000_dup.child)", "'undefined'");

-       check_equals(mo, "dynamicmc_30000_dup._width", 
"dynamicmc_30000._width");
+       xcheck_equals(mo, "dynamicmc_30000_dup._width", 
"dynamicmc_30000._width");
       xcheck_equals(mo, "parseInt(dynamicmc_30000_dup._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc_30000.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc_30000_dup.child)", "'undefined'");

       // Note that dynamicmc0_dup is at negative depth
-       check_equals(mo, "dynamicmc0_dup._width", "dynamicmc0._width");
+       xcheck_equals(mo, "dynamicmc0_dup._width", "dynamicmc0._width");
       xcheck_equals(mo, "parseInt(dynamicmc0_dup._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc0.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc0_dup.child)", "'undefined'");

       // Note that dynamicmc1048575_dup is at negative depth
-       check_equals(mo, "dynamicmc1048575_dup._width", 
"dynamicmc1048575._width");
+       xcheck_equals(mo, "dynamicmc1048575_dup._width", 
"dynamicmc1048575._width");
       xcheck_equals(mo, "parseInt(dynamicmc1048575_dup._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc1048575.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc1048575_dup.child)", "'undefined'");

-       check_equals(mo, "dynamicmc1048576_dup._width", 
"dynamicmc1048576._width");
-       xcheck_equals(mo, "parseInt(dynamicmc1048576._width/10)", "6");
+       xcheck_equals(mo, "dynamicmc1048576_dup._width", 
"dynamicmc1048576._width");
+       check_equals(mo, "parseInt(dynamicmc1048576._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc1048576.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc1048576_dup.child)", "'undefined'");

-       check_equals(mo, "dynamicmc2130690045_dup._width", 
"dynamicmc2130690045._width");
-       xcheck_equals(mo, "parseInt(dynamicmc2130690045._width/10)", "6");
+       xcheck_equals(mo, "dynamicmc2130690045_dup._width", 
"dynamicmc2130690045._width");
+       check_equals(mo, "parseInt(dynamicmc2130690045._width/10)", "6");
       check_equals(mo, "typeof(dynamicmc2130690045.child)", "'movieclip'");
       check_equals(mo, "typeof(dynamicmc2130690045_dup.child)", "'undefined'");



_______________________________________________
Gnash-commit mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnash-commit





reply via email to

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