gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/character.h server/dlist...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/character.h server/dlist...
Date: Mon, 29 Oct 2007 21:23:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/10/29 21:23:16

Modified files:
        .              : ChangeLog 
        server         : character.h dlist.cpp sprite_instance.cpp 
        testsuite/misc-ming.all: DrawingApiTest.as masks_test.c 
                                 masks_testrunner.cpp 

Log message:
                * server/character.h (setMask): set character as invalidated
                  when it's mask change. Needs more care: when the mask itself
                  changes, we should find a way to invalidate the maskee as 
well,
                  but we currently have no refefence from the mask to the 
maskee.
                * server/dlist.cpp (display): add support for dynamic masks.
                  Needs more care: test what happens with nested masks, check if
                  it is possible to trigger infinite recursions.
                * server/sprite_instance.cpp (sprite_setMask); draft support for
                  setMask. Needs more care: forbid a character to mask itself,
                  see care needed in dlist to avoid infinite recursion (A masks 
B
                  contining B2 maksing A)
                * testsuite/misc-ming.all/DrawingApiTest.as: turn user-defined 
cursor
                  into a mask or disable the mask on click (toggle). Needs 
testing
                  in the runner.
                * testsuite/misc-ming.all/masks_test.c: add comments.
                * testsuite/misc-ming.all/masks_testrunner.cpp: add section 
testing
                  for setMask effects on rendering. Needs more care: add test 
for
                  effect of swapDepth on next advance.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4737&r2=1.4738
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.103&r2=1.104
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.98&r2=1.99
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.373&r2=1.374
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTest.as?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_test.c?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_testrunner.cpp?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4737
retrieving revision 1.4738
diff -u -b -r1.4737 -r1.4738
--- ChangeLog   29 Oct 2007 21:07:32 -0000      1.4737
+++ ChangeLog   29 Oct 2007 21:23:15 -0000      1.4738
@@ -1,3 +1,25 @@
+2007-10-30 Sandro Santilli <address@hidden>
+
+       * server/character.h (setMask): set character as invalidated
+         when it's mask change. Needs more care: when the mask itself
+         changes, we should find a way to invalidate the maskee as well,
+         but we currently have no refefence from the mask to the maskee.
+       * server/dlist.cpp (display): add support for dynamic masks.
+         Needs more care: test what happens with nested masks, check if
+         it is possible to trigger infinite recursions.
+       * server/sprite_instance.cpp (sprite_setMask); draft support for
+         setMask. Needs more care: forbid a character to mask itself,
+         see care needed in dlist to avoid infinite recursion (A masks B
+         contining B2 maksing A)
+       * testsuite/misc-ming.all/DrawingApiTest.as: turn user-defined cursor
+         into a mask or disable the mask on click (toggle). Needs testing
+         in the runner.
+       * testsuite/misc-ming.all/masks_test.c: add comments.
+       * testsuite/misc-ming.all/masks_testrunner.cpp: add section testing
+         for setMask effects on rendering. Needs more care: add test for
+         effect of swapDepth on next advance.
+
+
 2007-10-30 Chad Musick <address@hidden>
 
        * server/StreamProvider.cpp: Even if LIBCURL is not being used,
@@ -15,7 +37,7 @@
          returned depends on local timezone, so you can't check to the second.
        * server/vm/SafeStack.h, server/vm/CodeStream.h -- Comment updates.
 
-2007-10-27 Sandro Santilli <address@hidden>
+2007-10-29 Sandro Santilli <address@hidden>
 
        * testsuite/MovieTester.cpp (checkPixel): multiply tolerance by
          minimum renderer tolerance.

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- server/character.h  29 Oct 2007 16:38:55 -0000      1.103
+++ server/character.h  29 Oct 2007 21:23:16 -0000      1.104
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: character.h,v 1.103 2007/10/29 16:38:55 strk Exp $ */
+/* $Id: character.h,v 1.104 2007/10/29 21:23:16 strk Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -556,6 +556,9 @@
        void setMask(character* mask)
        {
                if ( _mask == mask ) return;
+
+               set_invalidated();
+
                if ( _mask )
                {
                        // TODO: should we reset any original clip depth

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -b -r1.98 -r1.99
--- server/dlist.cpp    29 Oct 2007 16:38:55 -0000      1.98
+++ server/dlist.cpp    29 Oct 2007 21:23:16 -0000      1.99
@@ -761,6 +761,17 @@
                character* ch = it->get();
                assert(ch);
 
+               character* mask = ch->getMask();
+               if ( mask && ! mask->isUnloaded() )
+               {
+                       render::begin_submit_mask();
+                       mask->display();
+                       render::end_submit_mask();
+                       ch->display();
+                       render::disable_mask();
+                       continue;
+               }
+
                assert(! ch->isUnloaded() ); // we don't advance unloaded chars
 
                // Check if this charater or any of its parents is a mask.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.373
retrieving revision 1.374
diff -u -b -r1.373 -r1.374
--- server/sprite_instance.cpp  26 Oct 2007 13:03:56 -0000      1.373
+++ server/sprite_instance.cpp  29 Oct 2007 21:23:16 -0000      1.374
@@ -1060,14 +1060,41 @@
 sprite_setMask(const fn_call& fn)
 {
        boost::intrusive_ptr<sprite_instance> sprite = 
ensureType<sprite_instance>(fn.this_ptr);
-       UNUSED(sprite);
 
-       static bool warned = false;
-       if ( ! warned )
+       if ( ! fn.nargs )
        {
-               log_unimpl("MovieClip.setMask()");
-               warned=true;
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("%s.setMask() : needs an argument"), 
sprite->getTarget().c_str());
+               );
+               return as_value();
+       }
+
+       as_value& arg = fn.arg(0);
+       if ( arg.is_null() || arg.is_undefined() )
+       {
+               // disable mask
+               sprite->setMask(NULL);
+       }
+       else
+       {
+
+               boost::intrusive_ptr<as_object> obj ( arg.to_object() );
+               character* ch = dynamic_cast<character*>(obj.get());
+               if ( ! ch )
+               {
+                       IF_VERBOSE_ASCODING_ERRORS(
+                       log_aserror(_("%s.setMask(%s) : first argument is not a 
character"),
+                               sprite->getTarget().c_str(), 
arg.to_debug_string().c_str());
+                       );
+                       return as_value();
+               }
+
+               // ch is possibly NULL, which is intended
+               sprite->setMask(ch); 
        }
+
+       log_debug("MovieClip.setMask() TESTING");
+
        return as_value();
 }
 

Index: testsuite/misc-ming.all/DrawingApiTest.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DrawingApiTest.as,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- testsuite/misc-ming.all/DrawingApiTest.as   14 Sep 2007 16:32:38 -0000      
1.14
+++ testsuite/misc-ming.all/DrawingApiTest.as   29 Oct 2007 21:23:16 -0000      
1.15
@@ -8,7 +8,7 @@
 //     gnash DrawingApi.swf
 //
 
-rcsid="$Id: DrawingApiTest.as,v 1.14 2007/09/14 16:32:38 strk Exp $";
+rcsid="$Id: DrawingApiTest.as,v 1.15 2007/10/29 21:23:16 strk Exp $";
 
 #include "../actionscript.all/check.as"
 
@@ -313,3 +313,23 @@
                }
        };
 }
+
+
+isMask = false;
+onMouseDown = function()
+{
+       if ( isMask )
+       {
+               a.setMask(); // no effect !
+               a.setMask(true); // no effect !
+               trace("Disabling cursor mask");
+               a.setMask(undefined); // works
+               //a.setMask(null); // also work
+       }
+       else
+       {
+               trace("Enabling cursor mask");
+               a.setMask(cursor);
+       }
+       isMask = !isMask;
+};

Index: testsuite/misc-ming.all/masks_test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/masks_test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/masks_test.c        1 Jul 2007 10:54:57 -0000       
1.3
+++ testsuite/misc-ming.all/masks_test.c        29 Oct 2007 21:23:16 -0000      
1.4
@@ -127,21 +127,21 @@
        dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 
0, 0, 800, 600);
        it = SWFMovie_add(mo, (SWFBlock)dejagnuclip);
        SWFDisplayItem_setDepth(it, 1000);
-       SWFMovie_nextFrame(mo); 
+       SWFMovie_nextFrame(mo);  // FRAME 2 starts here
 
        add_actions(mo, "note('Test masks and dynamic masks at different depth 
ranges.');");
 
        // this one seems to confuse the MM player
        //add_static_mask(mo, "mask1", 1, 0, 150, 200, 100, 20);
 
-       add_static_mc(mo, "staticmc2", 2, 0, 200, 60, 60, 255, 0, 0);
-       add_static_mc(mo, "staticmc3", 3, 30, 200, 60, 60, 255, 255, 0);
-       add_static_mc(mo, "staticmc4", 4, 200, 200, 60, 60, 0, 255, 0);
-       add_static_mc(mo, "staticmc5", 5, 230, 200, 60, 60, 0, 255, 255);
-       add_dynamic_mc(mo, "dynamicmc2", 12, 0, 300, 60, 60, 0, 0, 255);
-       add_dynamic_mc(mo, "dynamicmc3", 13, 30, 300, 60, 60, 255, 0, 255);
-       add_dynamic_mc(mo, "dynamicmc4", 14, 200, 300, 60, 60, 0, 128, 0);
-       add_dynamic_mc(mo, "dynamicmc5", 15, 230, 300, 60, 60, 0, 128, 255);
+       add_static_mc(mo, "staticmc2", 2, 0, 200, 60, 60, 255, 0, 0); // red
+       add_static_mc(mo, "staticmc3", 3, 30, 200, 60, 60, 255, 255, 0); // 
yellow
+       add_static_mc(mo, "staticmc4", 4, 200, 200, 60, 60, 0, 255, 0); // green
+       add_static_mc(mo, "staticmc5", 5, 230, 200, 60, 60, 0, 255, 255); // 
cyan
+       add_dynamic_mc(mo, "dynamicmc2", 12, 0, 300, 60, 60, 0, 0, 255); // blue
+       add_dynamic_mc(mo, "dynamicmc3", 13, 30, 300, 60, 60, 255, 0, 255); // 
violet
+       add_dynamic_mc(mo, "dynamicmc4", 14, 200, 300, 60, 60, 0, 128, 0); // 
dark green
+       add_dynamic_mc(mo, "dynamicmc5", 15, 230, 300, 60, 60, 0, 128, 255); // 
light blue
 
 
        check_equals(mo, "staticmc2.getDepth()", "-16382");
@@ -153,18 +153,18 @@
        check_equals(mo, "dynamicmc4.getDepth()", "14"); 
        check_equals(mo, "dynamicmc5.getDepth()", "15"); 
 
-       SWFMovie_nextFrame(mo);        
+       SWFMovie_nextFrame(mo);  // FRAME 3 starts here
 
        add_actions(mo, "note('Using setMask on chars in the static depth range 
2.mask(3) and 5.mask(5)');");
 
        add_actions(mo, 
-               "staticmc2.setMask(staticmc3);"
-               "staticmc5.setMask(staticmc4);"
-               "dynamicmc2.setMask(dynamicmc3);"
-               "dynamicmc5.setMask(dynamicmc4);"
+               "staticmc2.setMask(staticmc3);" // red masked by yellow
+               "staticmc5.setMask(staticmc4);" // cyan masked by green
+               "dynamicmc2.setMask(dynamicmc3);" // blue masked by violet
+               "dynamicmc5.setMask(dynamicmc4);" // light blue masked by dark 
green 
                );
 
-       SWFMovie_nextFrame(mo);        
+       SWFMovie_nextFrame(mo);  // FRAME 4 starts here
 
        add_actions(mo, "note('Swapping chars 2/3 and 4/5 to see if masks are 
still in effect');");
 
@@ -184,7 +184,6 @@
        check_equals(mo, "dynamicmc4.getDepth()", "15"); 
        check_equals(mo, "dynamicmc5.getDepth()", "14"); 
 
-
        add_actions(mo, "_root.totals(); stop();");
 
        SWFMovie_nextFrame(mo);        

Index: testsuite/misc-ming.all/masks_testrunner.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/masks_testrunner.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/masks_testrunner.cpp        29 Oct 2007 19:31:42 
-0000      1.6
+++ testsuite/misc-ming.all/masks_testrunner.cpp        29 Oct 2007 21:23:16 
-0000      1.7
@@ -59,10 +59,11 @@
        invalidated = tester.getInvalidatedRanges();
        check( invalidated.contains(76, 4) ); // the "-xtrace enabled-" label...
 
-       tester.advance(); // FRAME 2
+       // FRAME 2 -- masks at different depth ranges
+       tester.advance();
        
        check_equals(root->get_play_state(), sprite_instance::PLAY);
-       check_equals(root->get_current_frame(), 1);
+       check_equals(root->get_current_frame(), 1); // 0-based
        check_equals(root->getDisplayList().size(), 9);
        root->getDisplayList().dump();
        check( tester.findDisplayItemByName(*root, "staticmc2") );
@@ -75,6 +76,7 @@
        check( tester.findDisplayItemByName(*root, "dynamicmc5") );
        invalidated = tester.getInvalidatedRanges();
 
+       rgba white(255,255,255,255);
        rgba red(255,0,0,255);
        rgba green(0,255,0,255);
        rgba blue(0,0,255,255);
@@ -124,6 +126,55 @@
        check( invalidated.contains(276, 331) );
        check_pixel(276,331, 2, light_blue, 2);
 
+       // FRAME 3
+       tester.advance();
+
+       // test effects of setMask here
+
+       // 14,232 = white (red not covered by its yellow mask)
+       check( invalidated.contains(14, 232) );
+       check_pixel(14,232, 2, white, 2);
+       // 48,232 = red (visible in the yellow mask)
+       check( invalidated.contains(48, 232) );
+       check_pixel(48,232, 2, red, 2);
+       // 80,232 = white (red not covered by its yellow mask)
+       check( invalidated.contains(80, 232) );
+       check_pixel(80,232, 2, white, 2);
+
+       // 214,232 = white (cyan not covered by its green mask)
+       check( invalidated.contains(214, 232) );
+       check_pixel(214,232, 2, white, 2);
+       // 248,232 = cyan (visible in its green mask)
+       check( invalidated.contains(248, 232) );
+       check_pixel(248,232, 2, cyan, 2);
+       // 276,232 = white (cyan not covered by its green mask)
+       check( invalidated.contains(276, 232) );
+       check_pixel(276,232, 2, white, 2);
+
+       // 14,331 = white (blue not covered by its violet mask)
+       check( invalidated.contains(14, 331) );
+       check_pixel(14,331, 2, white, 2);
+       // 48,331 = blue (visible in its violet mask)
+       check( invalidated.contains(48, 331) );
+       check_pixel(48,331, 2, blue, 2);
+       // 80,331 = white (blue not covered by its violet mask)
+       check( invalidated.contains(80, 331) );
+       check_pixel(80,331, 2, white, 2);
+
+       // 214,331 = white (light_blue not covered by its dark_green mask)
+       check( invalidated.contains(214, 331) );
+       check_pixel(214,331, 2, white, 2);
+       // 248,331 = light_blue (visible in its dark_green mask)
+       check( invalidated.contains(248, 331) );
+       check_pixel(248,331, 2, light_blue, 2);
+       // 276,331 = white (light_blue not covered by its dark_green mask)
+       check( invalidated.contains(276, 331) );
+       check_pixel(276,331, 2, white, 2);
+
+       // FRAME 3
+       tester.advance();
+
+       // test effects of swapDepth (should be none)
 
 }
 




reply via email to

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