gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp
Date: Tue, 8 Jan 2008 09:40:23 +0800

+       // swfdec/test/image/mask-textfield-6.swf shows that setMask should also
+       // work against TextFields, we have no tests for other
character types so
+       // we generalize it for any character.
+       boost::intrusive_ptr<character> maskee =
ensureType<character>(fn.this_ptr);

I checked swfdec/test/image/mask-textfield-6.swf. It tests that
TextField instances could be a mask(not maskee). Actually the
behaviour when  setMask work against TextField instance is odd to me,
maybe UdoG knows more about it.
But yes, setMask not only works for sprites,  but also for button
instances as I tested.

You might want to do a quick check with the following test, for
simulating tests in swfdec/test/image/mask-textfield-6.swf.

_root.createEmptyMovieClip("mc", 10);
with(mc)
{
   mc.beginFill(0xff0000);
    mc.moveTo(50, 50);
    mc.lineTo(50, 150);
    mc.lineTo(150, 150);
    mc.lineTo(150, 50);
    mc.lineTo(50, 50);
    mc.endFill();
}
_root.createTextField("txt", 9, 0, 0, 100, 100);
txt.background = true;
txt.backgroundColor = 0x00ff00;
txt.text = "Hello World";

txt.setMask = mc.setMask;
txt.setMask(mc);  // use textFiled instance to mask a sprite instance,
and it does work!

while the result of mc.setMask(txt) is not that obvious at the moment.

--zou






On Jan 7, 2008 7:44 PM, Sandro Santilli <address@hidden> wrote:
> CVSROOT:        /sources/gnash
> Module name:    gnash
> Changes by:     Sandro Santilli <strk>  08/01/07 11:44:10
>
> Modified files:
>         .              : ChangeLog
>         server         : sprite_instance.cpp
>
> Log message:
>         allow MovieClip.setMask to be called on any character, not just 
> sprites.
>         Fixes swfdec's image/mask-textfield-6.swf test (not automated).
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5327&r2=1.5328
> http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.427&r2=1.428
>
> Patches:
> Index: ChangeLog
> ===================================================================
> RCS file: /sources/gnash/gnash/ChangeLog,v
> retrieving revision 1.5327
> retrieving revision 1.5328
> diff -u -b -r1.5327 -r1.5328
> --- ChangeLog   7 Jan 2008 11:37:39 -0000       1.5327
> +++ ChangeLog   7 Jan 2008 11:44:10 -0000       1.5328
> @@ -1,3 +1,9 @@
> +2008-01-07 Sandro Santilli <address@hidden>
> +
> +       * server/sprite_instance.cpp (sprite_setMask): allow MovieClip.setMask
> +         to be called on any character, not just sprites. Fixes
> +         swfdec's image/mask-textfield-6.swf test (not automated).
> +
>  2008-01-07 Benjamin Wolsey <address@hidden>
>
>         * gui/gtk.cpp: move fullscreen to View menu and give it a pretty icon,
>
> Index: server/sprite_instance.cpp
> ===================================================================
> RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
> retrieving revision 1.427
> retrieving revision 1.428
> diff -u -b -r1.427 -r1.428
> --- server/sprite_instance.cpp  4 Jan 2008 13:10:45 -0000       1.427
> +++ server/sprite_instance.cpp  7 Jan 2008 11:44:10 -0000       1.428
> @@ -1076,12 +1076,15 @@
>  static as_value
>  sprite_setMask(const fn_call& fn)
>  {
> -       boost::intrusive_ptr<sprite_instance> sprite = 
> ensureType<sprite_instance>(fn.this_ptr);
> +       // swfdec/test/image/mask-textfield-6.swf shows that setMask should 
> also
> +       // work against TextFields, we have no tests for other character 
> types so
> +       // we generalize it for any character.
> +       boost::intrusive_ptr<character> maskee = 
> ensureType<character>(fn.this_ptr);
>
>         if ( ! fn.nargs )
>         {
>                 IF_VERBOSE_ASCODING_ERRORS(
> -               log_aserror(_("%s.setMask() : needs an argument"), 
> sprite->getTarget().c_str());
> +               log_aserror(_("%s.setMask() : needs an argument"), 
> maskee->getTarget().c_str());
>                 );
>                 return as_value();
>         }
> @@ -1090,24 +1093,24 @@
>         if ( arg.is_null() || arg.is_undefined() )
>         {
>                 // disable mask
> -               sprite->setMask(NULL);
> +               maskee->setMask(NULL);
>         }
>         else
>         {
>
>                 boost::intrusive_ptr<as_object> obj ( arg.to_object() );
> -               character* ch = dynamic_cast<character*>(obj.get());
> -               if ( ! ch )
> +               character* mask = dynamic_cast<character*>(obj.get());
> +               if ( ! mask )
>                 {
>                         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());
> +                               maskee->getTarget().c_str(), 
> arg.to_debug_string().c_str());
>                         );
>                         return as_value();
>                 }
>
>                 // ch is possibly NULL, which is intended
> -               sprite->setMask(ch);
> +               maskee->setMask(mask);
>         }
>
>         //log_debug("MovieClip.setMask() TESTING");
>
>
> _______________________________________________
> 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]