gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10356: Fix availability of initObje


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10356: Fix availability of initObject properties in constructor by passing the
Date: Wed, 26 Nov 2008 17:18:05 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10356
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-11-26 17:18:05 +0100
message:
  Fix availability of initObject properties in constructor by passing the
  object to (all) stagePlacementCallback() functions and re-arranging
  MovieClip:::stagePlacementCallback().
  
  Add some sort of implementation of getBytesLoaded and getBytesTotal for
  Sound objects. It's not fully correct, but perhaps someone will look at
  it now.
modified:
  libcore/Button.cpp
  libcore/Button.h
  libcore/DisplayList.cpp
  libcore/DisplayList.h
  libcore/MovieClip.cpp
  libcore/MovieClip.h
  libcore/Video.cpp
  libcore/Video.h
  libcore/asobj/Sound.cpp
  libcore/character.cpp
  libcore/character.h
  libcore/movie_instance.cpp
  libcore/movie_instance.h
  testsuite/actionscript.all/Sound.as
  testsuite/misc-ming.all/attachMovieLoopingTest.c
    ------------------------------------------------------------
    revno: 10355.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 10:49:35 +0100
    message:
      Cleanups, move property copying to before attachCharacter.
    modified:
      libcore/MovieClip.cpp
      libcore/character.cpp
    ------------------------------------------------------------
    revno: 10355.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 14:59:04 +0100
    message:
      Pass initObj to stagePlacementCallback so properties can be copied between
      setting correct bounds (display list dependent) and calling the 
constructor.
    modified:
      libcore/Button.cpp
      libcore/Button.h
      libcore/DisplayList.cpp
      libcore/DisplayList.h
      libcore/MovieClip.cpp
      libcore/MovieClip.h
      libcore/Video.cpp
      libcore/Video.h
      libcore/character.cpp
      libcore/character.h
      libcore/movie_instance.cpp
      libcore/movie_instance.h
      testsuite/misc-ming.all/attachMovieLoopingTest.c
    ------------------------------------------------------------
    revno: 10355.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 15:22:44 +0100
    message:
      Test results and give same treatment to duplicateMovieClip.
    modified:
      libcore/Button.cpp
      libcore/MovieClip.cpp
      testsuite/misc-ming.all/attachMovieLoopingTest.c
    ------------------------------------------------------------
    revno: 10355.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 15:39:42 +0100
    message:
      Return something from Sound.getBytesLoaded() and getBytesTotal().
    modified:
      libcore/asobj/Sound.cpp
    ------------------------------------------------------------
    revno: 10355.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 16:26:24 +0100
    message:
      Tidy up MovieClip:stagePlacementCallback a bit. Add notes and asserts
      to Video and Button placement callbacks.
    modified:
      libcore/Button.cpp
      libcore/MovieClip.cpp
      libcore/Video.cpp
    ------------------------------------------------------------
    revno: 10355.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Wed 2008-11-26 16:27:34 +0100
    message:
      Test passes.
    modified:
      testsuite/actionscript.all/Sound.as
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2008-11-24 09:47:16 +0000
+++ b/libcore/Button.cpp        2008-11-26 15:26:24 +0000
@@ -900,8 +900,13 @@
 }
 
 void
-Button::stagePlacementCallback()
+Button::stagePlacementCallback(as_object* initObj)
 {
+
+    // A Button cannot be created dynamically, so can't have an 
+    // initObj.
+    assert(!initObj);
+
     saveOriginalTarget(); // for soft refs
 
     // Register this button instance as a live character

=== modified file 'libcore/Button.h'
--- a/libcore/Button.h  2008-11-07 16:05:23 +0000
+++ b/libcore/Button.h  2008-11-26 13:59:04 +0000
@@ -133,7 +133,7 @@
        /// (1) Register this button instance as a live character
        /// (2) Setup the state characters calling stagePlacementCallback on 
all [WRONG]
        ///
-       virtual void stagePlacementCallback();
+       virtual void stagePlacementCallback(as_object* initObj = 0);
 
        /// Properly unload contained characters
        bool unload();

=== modified file 'libcore/DisplayList.cpp'
--- a/libcore/DisplayList.cpp   2008-10-25 10:38:32 +0000
+++ b/libcore/DisplayList.cpp   2008-11-26 13:59:04 +0000
@@ -177,7 +177,7 @@
 }
 
 void
-DisplayList::place_character(character* ch, int depth)
+DisplayList::place_character(character* ch, int depth, as_object* initObj)
 {
   assert(!ch->isUnloaded());
   ch->set_invalidated();
@@ -219,7 +219,7 @@
   }
 
   // Give life to this instance
-  ch->stagePlacementCallback();
+  ch->stagePlacementCallback(initObj);
 
   testInvariant();
 }

=== modified file 'libcore/DisplayList.h'
--- a/libcore/DisplayList.h     2008-10-25 10:38:32 +0000
+++ b/libcore/DisplayList.h     2008-11-26 13:59:04 +0000
@@ -102,7 +102,9 @@
        /// @param depth 
        ///     depth at which the new character is placed.
        ///
-       void    place_character(character* ch, int depth);
+    /// @param initObj
+    /// an object to initialize the new character's properties with.
+       void place_character(character* ch, int depth, as_object* initObj = 0);
 
        /// \brief
        /// Replace the old character at the specified depth with

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2008-11-20 15:22:13 +0000
+++ b/libcore/MovieClip.cpp     2008-11-26 15:26:24 +0000
@@ -213,7 +213,7 @@
     {
         // don't include bounds of unloaded characters
         if ( ch->isUnloaded() ) return;
-        rect    chb = ch->getBounds();
+        rect chb = ch->getBounds();
         SWFMatrix m = ch->getMatrix();
         _bounds.expand_to_transformed_rect(m, chb);
     }
@@ -393,13 +393,18 @@
     {
         try { *val = prop->getValue(*this); }
         catch (ActionLimitException&) { throw; }
-        catch (ActionTypeError& ex) { log_error(_("Caught exception: %s"), 
ex.what()); return false; }
+        catch (ActionTypeError& ex) {
+            log_error(_("Caught exception: %s"), ex.what());
+            return false;
+        }
         return true;
     }
 
     // Try items on our display list.
     character* ch;
-    if ( _vm.getSWFVersion() >= 7 ) ch =    
m_display_list.get_character_by_name(name);
+    if ( _vm.getSWFVersion() >= 7 ) {
+        ch = m_display_list.get_character_by_name(name);
+    }
     else ch = m_display_list.get_character_by_name_i(name);
     if (ch) {
             // Found object.
@@ -422,14 +427,15 @@
     TextFieldPtrVect* etc = get_textfield_variable(name);
     if ( etc )
     {
-        for (TextFieldPtrVect::const_iterator i=etc->begin(), e=etc->end(); 
i!=e; ++i)
+        for (TextFieldPtrVect::const_iterator i=etc->begin(), e=etc->end();
+                i!=e; ++i)
         {
-    TextFieldPtr tf = *i;
-    if ( tf->getTextDefined() )
-    {
-        val->set_string(tf->get_text_value());
+            TextFieldPtr tf = *i;
+            if ( tf->getTextDefined() )
+            {
+                val->set_string(tf->get_text_value());
                 return true;
-    }
+            }
         }
     }
 
@@ -596,11 +602,12 @@
 
     newmovieclip->setDynamic();
 
-    if ( initObject ) newmovieclip->copyProperties(*initObject);
+    //if ( initObject ) newmovieclip->copyProperties(*initObject);
     //else newmovieclip->copyProperties(*this);
 
     // Copy event handlers from movieclip
-    // We should not copy 'm_action_buffer' since the 'm_method' already 
contains it
+    // We should not copy 'm_action_buffer' since the 
+    // 'm_method' already contains it
     newmovieclip->set_event_handlers(get_event_handlers());
 
     // Copy drawable
@@ -611,7 +618,8 @@
     newmovieclip->set_ratio(get_ratio());    
     newmovieclip->set_clip_depth(get_clip_depth());    
     
-    parent->m_display_list.place_character(newmovieclip.get(), depth);
+    parent->m_display_list.place_character(newmovieclip.get(), depth, 
+            initObject);
     
     return newmovieclip; 
 }
@@ -1266,11 +1274,12 @@
 }
 
 bool
-MovieClip::attachCharacter(character& newch, int depth)
+MovieClip::attachCharacter(character& newch, int depth, as_object* initObject)
 { 
-    m_display_list.place_character(&newch, depth);    
+    m_display_list.place_character(&newch, depth, initObject);    
 
-    return true; // FIXME: check return from place_character above ?
+    // FIXME: check return from place_character above ?
+    return true; 
 }
 
 character*
@@ -2123,15 +2132,14 @@
     _vm.getRoot().add_key_listener(this);
     _vm.getRoot().add_mouse_listener(this);
 }
-    
-
-
-// WARNING: THIS SNIPPET NEEDS THE CHARACTER TO BE "INSTANTIATED", which is
-//          it's target path needs to exist, or any as_value for it will be
+
+
+// WARNING: THIS SNIPPET NEEDS THE CHARACTER TO BE "INSTANTIATED", that is,
+//          its target path needs to exist, or any as_value for it will be
 //          a dangling reference to an unexistent movieclip !
 //          NOTE: this is just due to the wrong steps, see comment in header
 void
-MovieClip::stagePlacementCallback()
+MovieClip::stagePlacementCallback(as_object* initObj)
 {
     assert(!isUnloaded());
 
@@ -2143,46 +2151,66 @@
 
     // Register this movieclip as a live one
     _vm.getRoot().addLiveChar(this);
+  
 
     // Register this movieclip as a core broadcasters listener
     registerAsListener();
 
     // It seems it's legal to place 0-framed movieclips on stage.
     // See testsuite/misc-swfmill.all/zeroframe_definemovieclip.swf
-    //m_def->ensure_frame_loaded(0);
-
-#if 0
-    // We might have loaded NO frames !
-    bool hasFrames = get_loaded_frames();
-    if ( ! hasFrames )
-    {
-        IF_VERBOSE_MALFORMED_SWF(
-        LOG_ONCE( log_swferror(_("stagePlacementCallback: no frames loaded for 
movieclip/movie %s"), getTarget()) );
-        );
-    }
-#endif
+
+
+    // Now execute frame tags and take care of queuing the LOAD event.
+    //
+    // DLIST tags are executed immediately while ACTION tags are queued.
+    //
+    // For _root movie, LOAD event is invoked *after* actions in first frame
+    // See misc-ming.all/action_execution_order_test4.{c,swf}
+    //
+    assert(!_callingFrameActions); // or will not be queuing actions
+    if ( get_parent() == 0 )
+    {
+#ifdef GNASH_DEBUG
+        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
+#endif
+        execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
+
+        if ( _vm.getSWFVersion() > 5 )
+        {
+#ifdef GNASH_DEBUG
+            log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
+#endif
+            queueEvent(event_id::LOAD, movie_root::apDOACTION);
+        }
+
+    }
+    else
+    {
+
+#ifdef GNASH_DEBUG
+        log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
+#endif
+        queueEvent(event_id::LOAD, movie_root::apDOACTION);
+
+#ifdef GNASH_DEBUG
+        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
+#endif
+        execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
+    }
 
     // We execute events immediately when the stage-placed character 
     // is dynamic, This is becase we assume that this means that 
     // the character is placed during processing of actions (opposed 
     // that during advancement iteration).
     //
-    // A more general implementation might ask movie_root about it's state
+    // A more general implementation might ask movie_root about its state
     // (iterating or processing actions?)
     // Another possibility to inspect could be letting movie_root decide
     // when to really queue and when rather to execute immediately the 
     // events with priority INITIALIZE or CONSTRUCT ...
-    if ( isDynamic() )
-    {
-#ifdef GNASH_DEBUG
-        log_debug(_("Sprite %s is dynamic, sending "
-                "INITIALIZE and CONSTRUCT events immediately"), getTarget());
-#endif
-        on_event(event_id::INITIALIZE);
-        constructAsScriptObject(); 
-    }
-    else
-    {
+    if (!isDynamic())
+    {
+        assert(!initObj);
 #ifdef GNASH_DEBUG
         log_debug(_("Queuing INITIALIZE event for movieclip %s"), getTarget());
 #endif
@@ -2194,44 +2222,24 @@
         std::auto_ptr<ExecutableCode> code ( new ConstructEvent(this) );
         _vm.getRoot().pushAction(code, movie_root::apCONSTRUCT);
     }
-
-    // Now execute frame tags and take care of queuing the LOAD event.
-    //
-    // DLIST tags are executed immediately while ACTION tags are queued.
-    //
-    // For _root movie, LOAD event is invoked *after* actions in first frame
-    // See misc-ming.all/action_execution_order_test4.{c,swf}
-    //
-    assert(!_callingFrameActions); // or will not be queuing actions
-    if ( get_parent() == 0 )
-    {
-#ifdef GNASH_DEBUG
-        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
-#endif
-        execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
-
-        if ( _vm.getSWFVersion() > 5 )
-        {
-#ifdef GNASH_DEBUG
-            log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
-#endif
-            queueEvent(event_id::LOAD, movie_root::apDOACTION);
+    else {
+
+        // Properties from an initObj must be copied before construction, but
+        // after the display list has been populated, so that _height and
+        // _width (which depend on bounds) are correct.
+        if (initObj) {
+            copyProperties(*initObj);
         }
 
-    }
-    else
-    {
-
-#ifdef GNASH_DEBUG
-        log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
-#endif
-        queueEvent(event_id::LOAD, movie_root::apDOACTION);
-
-#ifdef GNASH_DEBUG
-        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
-#endif
-        execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
-    }
+        constructAsScriptObject(); 
+#ifdef GNASH_DEBUG
+        log_debug(_("Sprite %s is dynamic, sending "
+                "INITIALIZE and CONSTRUCT events immediately"), getTarget());
+#endif
+
+        on_event(event_id::INITIALIZE);
+    }
+
 
 }
 
@@ -2311,7 +2319,7 @@
                 fn_call call(this, &env);
                 call.super = super;
 
-                // we don't use the constructor return (should we?)
+                    // we don't use the constructor return (should we?)
                 (*ctor)(call);
             }
         }
@@ -3226,7 +3234,6 @@
     boost::intrusive_ptr<character> newch =
         exported_movie->create_character_instance(movieclip.get(), 0);
 
-    assert(newch.get() > reinterpret_cast<void*>(0xFFFF) );
 #ifndef GNASH_USE_GC
     assert(newch->get_ref_count() > 0);
 #endif // ndef GNASH_USE_GC
@@ -3234,25 +3241,14 @@
     newch->set_name(newname);
     newch->setDynamic();
 
-    // place_character() will set depth on newch
-    if ( ! movieclip->attachCharacter(*newch, depthValue) )
-    {
-        log_error(_("Could not attach character at depth %d"), depthValue);
-        return as_value();
-    }
+    boost::intrusive_ptr<as_object> initObj;
 
-    /// Properties must be copied *after* the call to attachCharacter
-    /// because attachCharacter() will reset SWFMatrix !!
     if (fn.nargs > 3 ) {
-        boost::intrusive_ptr<as_object> initObject = fn.arg(3).to_object();
-        if ( initObject ) {
-            //log_debug(_("Initializing properties from object"));
-            newch->copyProperties(*initObject);
-        }
-        else {
+        initObj = fn.arg(3).to_object();
+        if (!initObj) {
             // This is actually a valid thing to do,
             // the documented behaviour is to just NOT
-            // initializing the properties in this
+            // initialize the properties in this
             // case.
             IF_VERBOSE_ASCODING_ERRORS(
                 log_aserror(_("Fourth argument of attachMovie doesn't cast to "
@@ -3261,6 +3257,14 @@
             );
         }
     }
+
+    // place_character() will set depth on newch
+    if (!movieclip->attachCharacter(*newch, depthValue, initObj.get()))
+    {
+        log_error(_("Could not attach character at depth %d"), depthValue);
+        return as_value();
+    }
+
     return as_value(newch.get());
 }
 
@@ -3538,7 +3542,8 @@
             depth > character::upperAccessibleBound)
     {
         IF_VERBOSE_ASCODING_ERRORS(
-                log_aserror(_("MovieClip.duplicateMovieClip: invalid depth %d 
passed; not duplicating"), depth);
+                log_aserror(_("MovieClip.duplicateMovieClip: "
+                        "invalid depth %d passed; not duplicating"), depth);
         );    
         return as_value();
     }
@@ -3551,7 +3556,8 @@
     if (fn.nargs == 3)
     {
         boost::intrusive_ptr<as_object> initObject = fn.arg(2).to_object();
-        ch = movieclip->duplicateMovieClip(newname, depthValue, 
initObject.get());
+        ch = movieclip->duplicateMovieClip(newname, depthValue,
+                initObject.get());
     }
     else
     {

=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h       2008-11-13 15:33:38 +0000
+++ b/libcore/MovieClip.h       2008-11-26 13:59:04 +0000
@@ -439,7 +439,7 @@
     /// @return true on success, false on failure
     /// FIXME: currently never returns false !
     ///
-    bool attachCharacter(character& newch, int depth);
+    bool attachCharacter(character& newch, int depth, as_object* initObject);
 
     /// Handle placement event
     //
@@ -455,7 +455,7 @@
     /// (1) Construct this instance as an ActionScript object.
     ///     See constructAsScriptObject() method.
     ///
-    virtual void stagePlacementCallback();
+    virtual void stagePlacementCallback(as_object* initObj = 0);
 
     /// Unload all contents in the displaylist and this instance
     /// See character::unload for more info

=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2008-11-25 15:14:06 +0000
+++ b/libcore/Video.cpp 2008-11-26 15:26:24 +0000
@@ -245,8 +245,12 @@
 }
 
 void
-Video::stagePlacementCallback()
+Video::stagePlacementCallback(as_object* initObj)
 {
+
+    // A Video cannot be created with an initObj
+    assert(!initObj);
+
     saveOriginalTarget(); // for softref
 
     // Register this video instance as a live character

=== modified file 'libcore/Video.h'
--- a/libcore/Video.h   2008-11-12 09:23:42 +0000
+++ b/libcore/Video.h   2008-11-26 13:59:04 +0000
@@ -66,7 +66,7 @@
        virtual void advance();
 
        /// Register this video instance as a live character
-       virtual void stagePlacementCallback();
+       virtual void stagePlacementCallback(as_object* initObj = 0);
 
        void display();
 

=== modified file 'libcore/asobj/Sound.cpp'
--- a/libcore/asobj/Sound.cpp   2008-11-24 09:47:16 +0000
+++ b/libcore/asobj/Sound.cpp   2008-11-26 14:39:42 +0000
@@ -115,7 +115,7 @@
 Sound::getBytesLoaded()
 {
        if ( _mediaParser ) return _mediaParser->getBytesLoaded();
-       return 0;
+       return -1;
 }
 
 long
@@ -736,17 +736,21 @@
 }
 
 as_value
-sound_getbytesloaded(const fn_call& /*fn*/)
+sound_getbytesloaded(const fn_call& fn)
 {
-       LOG_ONCE( log_unimpl ("Sound.getBytesLoaded()") );
-       return as_value();
+       boost::intrusive_ptr<Sound> so = ensureType<Sound>(fn.this_ptr);
+       long loaded = so->getBytesLoaded();
+    if (loaded < 0) return as_value();
+    return as_value(loaded);
 }
 
 as_value
-sound_getbytestotal(const fn_call& /*fn*/)
+sound_getbytestotal(const fn_call& fn)
 {
-       LOG_ONCE( log_unimpl ("Sound.getBytesTotal()") );
-       return as_value();
+       boost::intrusive_ptr<Sound> so = ensureType<Sound>(fn.this_ptr);
+       long total = so->getBytesTotal();
+    if (total < 0) return as_value();
+    return as_value(total);
 }
 
 as_value

=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-11-26 09:06:38 +0000
+++ b/libcore/character.cpp     2008-11-26 13:59:04 +0000
@@ -334,7 +334,8 @@
         }
 
                SWFMatrix m = ptr->getMatrix();
-        // NOTE: infinite_to_zero is wrong here, see 
actionscript.all/setProperty.as
+        // NOTE: infinite_to_zero is wrong here, 
+        // see actionscript.all/setProperty.as
                
m.set_y_translation(PIXELS_TO_TWIPS(utility::infinite_to_zero(newy)));
                ptr->setMatrix(m); // no need to update caches when only 
changing translation
                ptr->transformedByScript(); // m_accept_anim_moves = false; 
@@ -649,7 +650,7 @@
        {
                SWFMatrix m = ptr->getMatrix();
                m.transform(bounds);
-               double h = TWIPS_TO_PIXELS( bounds.height() );      
+               double h = TWIPS_TO_PIXELS(bounds.height());      
                rv = as_value(h);
        }
        else // setter
@@ -660,7 +661,7 @@
                {
                        IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror(_("Setting _height=%g of character %s 
(%s)"),
-                                       newheight / 20,ptr->getTarget(), 
typeName(*ptr));
+                                       newheight / 20, ptr->getTarget(), 
typeName(*ptr));
                        );
                }
 
@@ -674,6 +675,7 @@
 character::set_height(double newheight)
 {
        const rect bounds = getBounds();
+
 #if 0
        if ( bounds.is_null() ) {
                log_unimpl("FIXME: when setting _height of null-bounds 
character it seems we're supposed to change _xscale too (see MovieClip.as)");
@@ -682,13 +684,13 @@
        const double oldheight = bounds.height();
        assert(oldheight >= 0); // can't be negative can it?
 
-        double yscale = oldheight ? (newheight / oldheight) : 0; // avoid 
division by zero
-        double xscale = _xscale / 100.0;
-        double rotation = _rotation * PI / 180.0;
+    double yscale = oldheight ? (newheight / oldheight) : 0; // avoid division 
by zero
+    double xscale = _xscale / 100.0;
+    double rotation = _rotation * PI / 180.0;
 
-        SWFMatrix m = getMatrix();
-        m.set_scale_rotation(xscale, yscale, rotation);
-        setMatrix(m, true); // let caches be updated
+    SWFMatrix m = getMatrix();
+    m.set_scale_rotation(xscale, yscale, rotation);
+    setMatrix(m, true); // let caches be updated
 }
 
 as_value
@@ -798,23 +800,18 @@
 character::setMatrix(const SWFMatrix& m, bool updateCache)
 {
 
-    if (!(m == m_matrix))
-    {
-        //log_debug("setting SWFMatrix to: %s", m);
-               set_invalidated(__FILE__, __LINE__);
-               m_matrix = m;
-
-               if ( updateCache ) // don't update caches if SWFMatrix wasn't 
updated too
-               {
-                       _xscale = m_matrix.get_x_scale() * 100.0;
-                       _yscale = m_matrix.get_y_scale() * 100.0;
-                       _rotation = m_matrix.get_rotation() * 180.0 / PI;
-               }
-    }
-    else
-    {
-        //log_debug("setMatrix of character %s: SWFMatrix "
-        //"not changed", getTarget());
+    if (m == m_matrix) return;
+
+    //log_debug("setting SWFMatrix to: %s", m);
+    set_invalidated(__FILE__, __LINE__);
+    m_matrix = m;
+
+    // don't update caches if SWFMatrix wasn't updated too
+    if (updateCache) 
+    {
+        _xscale = m_matrix.get_x_scale() * 100.0;
+        _yscale = m_matrix.get_y_scale() * 100.0;
+        _rotation = m_matrix.get_rotation() * 180.0 / PI;
     }
 
 }
@@ -966,10 +963,8 @@
 
        //log_debug("xscale cached: %d, yscale cached: %d", _xscale, _yscale);
 
-        if (_xscale < 0 ) // TODO: check if there's any case we should use 
_yscale here
-       {
-               rotation += PI;
-       }
+    // TODO: check if there's any case we should use _yscale here
+    if (_xscale < 0 ) rotation += PI; 
 
        SWFMatrix m = getMatrix();
     m.set_rotation(rotation);
@@ -987,10 +982,7 @@
     
     if (yscale != 0.0 && _yscale != 0.0)
     {
-        if (scale_percent * _yscale < 0.0)
-        {
-            yscale = -std::abs(yscale);
-        }
+        if (scale_percent * _yscale < 0.0) yscale = -std::abs(yscale);
         else yscale = std::abs(yscale);
     }
 
@@ -1104,8 +1096,8 @@
                                // character created using 'new'
                                // like, new MovieClip, new Video, new 
TextField...
                                // 
-                               log_debug("Character %p (%s) doesn't have a 
parent and is not a movie_instance",
-                                       ch, typeName(*ch));
+                               log_debug("Character %p (%s) doesn't have a 
parent and "
+                        "is not a movie_instance", ch, typeName(*ch));
                                ss << "<no parent, depth" << ch->get_depth() << 
">";
                                path.push_back(ss.str());
                        }

=== modified file 'libcore/character.h'
--- a/libcore/character.h       2008-11-25 16:13:14 +0000
+++ b/libcore/character.h       2008-11-26 13:59:04 +0000
@@ -1108,7 +1108,7 @@
   /// If you override the method remember to call saveOriginalTarget()
   /// as the first thing.
   ///
-  virtual void stagePlacementCallback()
+  virtual void stagePlacementCallback(as_object* = 0)
   {
     saveOriginalTarget();
   }

=== modified file 'libcore/movie_instance.cpp'
--- a/libcore/movie_instance.cpp        2008-10-25 10:38:32 +0000
+++ b/libcore/movie_instance.cpp        2008-11-26 13:59:04 +0000
@@ -37,7 +37,7 @@
 }
 
 void
-movie_instance::stagePlacementCallback()
+movie_instance::stagePlacementCallback(as_object* initObj)
 {
        saveOriginalTarget();
 

=== modified file 'libcore/movie_instance.h'
--- a/libcore/movie_instance.h  2008-11-12 09:23:42 +0000
+++ b/libcore/movie_instance.h  2008-11-26 13:59:04 +0000
@@ -58,7 +58,7 @@
        ///
        /// It's intended to be called by movie_root::setLevel().
        ///
-       void stagePlacementCallback();
+       void stagePlacementCallback(as_object* initObj = 0);
 
        /// Set a character in the dictionary as initialized, returning
        /// true if not already initialized.

=== modified file 'testsuite/actionscript.all/Sound.as'
--- a/testsuite/actionscript.all/Sound.as       2008-11-04 16:11:57 +0000
+++ b/testsuite/actionscript.all/Sound.as       2008-11-26 15:27:34 +0000
@@ -261,8 +261,8 @@
 s.loadSound(MEDIA(sound1.mp3), true); 
 
 
-xcheck_equals(typeof(s.getBytesTotal()), "number");
-xcheck_equals(typeof(s.getBytesLoaded()), "number");
+check_equals(typeof(s.getBytesTotal()), "number");
+check_equals(typeof(s.getBytesLoaded()), "number");
 xcheck_equals(typeof(s.getPosition()), "number");
 check_equals(typeof(s.duration), "number");
 xcheck_equals(typeof(s.getDuration()), "number");

=== modified file 'testsuite/misc-ming.all/attachMovieLoopingTest.c'
--- a/testsuite/misc-ming.all/attachMovieLoopingTest.c  2008-11-26 09:06:38 
+0000
+++ b/testsuite/misc-ming.all/attachMovieLoopingTest.c  2008-11-26 14:22:44 
+0000
@@ -112,16 +112,16 @@
        add_actions(mo, "redsquare = function() { "
             "           trace('hello redsquare'); "
             "           if (counter > 0) {"
-            "               xcheck_equals(this._x, counter * 70);"
-            "               xcheck_equals(Math.round(this._xscale), 99);"
-            "               xcheck_equals(Math.round(this._yscale), "
+            "               check_equals(this._x, counter * 70);"
+            "               check_equals(Math.round(this._xscale), 99);"
+            "               check_equals(Math.round(this._yscale), "
             "                       Math.round((10 * counter +5) / 60 * 100));"
-            "                  xcheck_equals(this._height, 10 * counter + 5); "
-            "                  xcheck_equals(this.aProperty, 6); "
+            "                  check_equals(this._height, 10 * counter + 5); "
+            "                  check_equals(this.aProperty, 6); "
             "           } else {"
             "               check_equals(this._x, 0);"
             "               check_equals(this._xscale, 100);"
-            "               xcheck_equals(this._height, 60.1);"
+            "               check_equals(this._height, 60.1);"
             "                  check_equals(this.aProperty, undefined); "
             "           };"
             "       };"
@@ -147,11 +147,14 @@
                "                       'square'+counter, 70+counter);"
                "       }"
                "       check_equals(this['square'+counter]._x, 70*counter);"
-               "       note('Depth is '+70*counter);"
+        "   if (counter > 0) {"
+               "           check_equals(this['square'+counter]._height, 10 * 
counter + 5);"
+               "   };"
+        "      note('Depth is '+70*counter);"
                "       counter++;"
                "       note('Next counter is '+counter);"
                "} else {"
-               "       totals(23); stop();"
+               "       totals(26); stop();"
                "}"
                );
 


reply via email to

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