gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10791: Restore BitmapMovie's use of


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10791: Restore BitmapMovie's use of DisplayList, fixing loadMovieTest again,
Date: Wed, 15 Apr 2009 12:16:53 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10791
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-04-15 12:16:53 +0200
message:
  Restore BitmapMovie's use of DisplayList, fixing loadMovieTest again,
  as strk pointed out.
  
  Const correct definitions.
modified:
  libcore/BitmapMovie.cpp
  libcore/BitmapMovie.h
  libcore/Button.cpp
  libcore/Button.h
  libcore/Video.cpp
  libcore/Video.h
  libcore/parser/BitmapMovieDefinition.cpp
  libcore/parser/BitmapMovieDefinition.h
  libcore/parser/SWFMovieDefinition.h
  libcore/parser/sprite_definition.cpp
  libcore/parser/sprite_definition.h
  libcore/swf/DefineButtonTag.cpp
  libcore/swf/DefineButtonTag.h
  libcore/swf/DefineEditTextTag.cpp
  libcore/swf/DefineEditTextTag.h
  libcore/swf/DefineMorphShapeTag.cpp
  libcore/swf/DefineMorphShapeTag.h
  libcore/swf/DefineShapeTag.cpp
  libcore/swf/DefineShapeTag.h
  libcore/swf/DefineTextTag.cpp
  libcore/swf/DefineTextTag.h
  libcore/swf/DefineVideoStreamTag.cpp
  libcore/swf/DefineVideoStreamTag.h
  libcore/swf/DefinitionTag.h
    ------------------------------------------------------------
    revno: 10788.2.24
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-04-15 11:08:37 +0200
    message:
      Restore BitmapMovie as a full MovieClip with DisplayList, as strk pointed
      out there is a non-automated test showing this is the case.
      
      Make createDisplayObject const correct so that it can be called from
      BitmapMovie's const definition. This revealed that many other definition
      classes had non-const methods, and some DisplayObjects had non-const
      definitions. This is now also fixed.
    modified:
      libcore/BitmapMovie.cpp
      libcore/BitmapMovie.h
      libcore/Button.cpp
      libcore/Button.h
      libcore/Video.cpp
      libcore/Video.h
      libcore/parser/BitmapMovieDefinition.cpp
      libcore/parser/BitmapMovieDefinition.h
      libcore/parser/SWFMovieDefinition.h
      libcore/parser/sprite_definition.cpp
      libcore/parser/sprite_definition.h
      libcore/swf/DefineButtonTag.cpp
      libcore/swf/DefineButtonTag.h
      libcore/swf/DefineEditTextTag.cpp
      libcore/swf/DefineEditTextTag.h
      libcore/swf/DefineMorphShapeTag.cpp
      libcore/swf/DefineMorphShapeTag.h
      libcore/swf/DefineShapeTag.cpp
      libcore/swf/DefineShapeTag.h
      libcore/swf/DefineTextTag.cpp
      libcore/swf/DefineTextTag.h
      libcore/swf/DefineVideoStreamTag.cpp
      libcore/swf/DefineVideoStreamTag.h
      libcore/swf/DefinitionTag.h
=== modified file 'libcore/BitmapMovie.cpp'
--- a/libcore/BitmapMovie.cpp   2009-04-14 20:13:59 +0000
+++ b/libcore/BitmapMovie.cpp   2009-04-15 09:08:37 +0000
@@ -17,9 +17,6 @@
 
 #include "BitmapMovie.h"
 #include "BitmapMovieDefinition.h"
-#include "fill_style.h"
-#include "Geometry.h" // for class path and class edge
-#include "render.h" // for ::display
 
 namespace gnash {
 
@@ -29,12 +26,11 @@
        Movie(def, parent),
     _def(def)
 {
-}
+    assert(def);
+    boost::intrusive_ptr<DisplayObject> ch = def->createDisplayObject(this, 1);
 
-void
-BitmapMovie::display()
-{
-    _def->shape().display(*this);
+    const int depth = 1 + DisplayObject::staticDepthOffset;
+    placeDisplayObject(ch.get(), depth);
 }
 
 std::auto_ptr<GnashImage>

=== modified file 'libcore/BitmapMovie.h'
--- a/libcore/BitmapMovie.h     2009-04-15 06:22:17 +0000
+++ b/libcore/BitmapMovie.h     2009-04-15 09:08:37 +0000
@@ -35,16 +35,8 @@
 
 /// A top-level movie displaying a still bitmap.
 //
-/// It is uncomfortable that this inherits from MovieClip, as it
-/// has no DisplayList, no actions, and no frames. But its sister class
-/// SWFMovie is a kind of MovieClip (or Sprite), so this arrangement
-/// is necessary for now.
-//
-/// It is a mouse entity, so can receive mouse events, and should also be
-/// draggable.
-//
-/// The class should override all MovieClip methods that rely on the
-/// DisplayList: currently point tests and display().
+///  A loaded BitmapMovie is tested in misc-ming.all/loadMovieTest.swf to
+///  have a DisplayList, so it is appropriate that it inherits from MovieClip.
 class BitmapMovie : public Movie
 {
 
@@ -54,30 +46,9 @@
 
        virtual ~BitmapMovie() {}
     
-    /// Return true if the point is within our bounds
-    //
-    /// MovieClip traverses the DisplayList for this.
-    bool pointInVisibleShape(boost::int32_t x, boost::int32_t y) const {
-        if (!visible()) return false;
-        return pointInBounds(x, y);
-    }
-
     /// This is a no-op for a BitmapMovie, as it never changes.
        virtual void advance() { }
 
-    /// Return the bounds of this BitmapMovie.
-    //
-    /// MovieClip uses the DisplayList to calculate this. For us it is
-    /// simpler.
-    virtual rect getBounds() const {
-        return _def->get_frame_size();
-    }
- 
-    /// Render the BitmapMovie.
-    //
-    /// This draws the bitmap directly using the BitmapMovie's matrix.
-    virtual void display();
-
     virtual float frameRate() const {
         return _def->get_frame_rate();
     }

=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2009-04-15 05:33:51 +0000
+++ b/libcore/Button.cpp        2009-04-15 09:08:37 +0000
@@ -294,7 +294,8 @@
 
 }
 
-Button::Button(SWF::DefineButtonTag& def, DisplayObject* parent, int id)
+Button::Button(const SWF::DefineButtonTag* const def, DisplayObject* parent,
+        int id)
     :
     InteractiveObject(parent, id),
     m_last_mouse_flags(IDLE),
@@ -306,7 +307,7 @@
     set_prototype(getButtonInterface());
 
     // check up presence Key events
-    if ( _def.hasKeyPressHandler() )
+    if ( _def->hasKeyPressHandler() )
     {
         _vm.getRoot().add_key_listener(this);
     }
@@ -352,7 +353,7 @@
     if ( id.keyCode() == key::INVALID ) return false;
 
     ButtonActionPusher xec(getVM().getRoot(), this); 
-    _def.forEachTrigger(id, xec);
+    _def->forEachTrigger(id, xec);
 
     return xec.called;
 }
@@ -492,7 +493,7 @@
     // Button transition sounds.
     do {
 
-        if (!_def.hasSound()) break;
+        if (!_def->hasSound()) break;
 
         // Check if there is a sound handler
         sound::sound_handler* s = _vm.getRoot().runInfo().soundHandler();
@@ -523,7 +524,7 @@
         if (bi < 0) break;
 
         const SWF::DefineButtonSoundTag::ButtonSound& bs = 
-            _def.buttonSound(bi);
+            _def->buttonSound(bi);
 
         // DisplayObject zero is considered as null DisplayObject
         if (!bs.soundID) break;
@@ -566,7 +567,7 @@
     movie_root& mr = getVM().getRoot();
 
     ButtonActionPusher xec(mr, this); 
-    _def.forEachTrigger(event, xec);
+    _def->forEachTrigger(event, xec);
 
     // check for built-in event handler.
     std::auto_ptr<ExecutableCode> code ( get_event_handler(event) );
@@ -621,7 +622,7 @@
     list.clear();
     
     using namespace SWF;
-    const DefineButtonTag::ButtonRecords& br = _def.buttonRecords();
+    const DefineButtonTag::ButtonRecords& br = _def->buttonRecords();
     size_t index = 0;
 
     for (DefineButtonTag::ButtonRecords::const_iterator i = br.begin(),
@@ -727,7 +728,7 @@
             if ( ! oldch )
             {
                 // Not there, instantiate
-                SWF::ButtonRecord& bdef = _def.buttonRecords()[i];
+                const SWF::ButtonRecord& bdef = _def->buttonRecords()[i];
 
                 const SWFMatrix& mat = bdef.m_button_matrix;
                 const cxform& cx = bdef.m_button_cxform;
@@ -890,7 +891,7 @@
     get_active_records(hitChars, HIT);
     for (ActiveRecords::iterator i=hitChars.begin(),e=hitChars.end(); i!=e; 
++i)
     {
-        SWF::ButtonRecord& bdef = _def.buttonRecords()[*i];
+        const SWF::ButtonRecord& bdef = _def->buttonRecords()[*i];
 
         const SWFMatrix& mat = bdef.m_button_matrix;
         const cxform& cx = bdef.m_button_cxform;
@@ -915,7 +916,7 @@
     // Some slots will probably be never used (consider HIT-only records)
     // but for now this direct corrispondence between record number
     // and active DisplayObject will be handy.
-    _stateCharacters.resize(_def.buttonRecords().size());
+    _stateCharacters.resize(_def->buttonRecords().size());
 
     // Instantiate the default state DisplayObjects 
     ActiveRecords upChars;
@@ -924,7 +925,7 @@
     for (ActiveRecords::iterator i=upChars.begin(),e=upChars.end(); i!=e; ++i)
     {
         int rno = *i;
-        SWF::ButtonRecord& bdef = _def.buttonRecords()[rno];
+        const SWF::ButtonRecord& bdef = _def->buttonRecords()[rno];
 
         const SWFMatrix& mat = bdef.m_button_matrix;
         const cxform& cx = bdef.m_button_cxform;
@@ -959,7 +960,7 @@
 {
     assert(isReachable());
 
-    _def.setReachable();
+    _def->setReachable();
 
     // Mark state DisplayObjects as reachable
     for (DisplayObjects::const_iterator i=_stateCharacters.begin(), 
e=_stateCharacters.end();
@@ -1132,7 +1133,7 @@
 int
 Button::getSWFVersion() const
 {
-    return _def.getSWFVersion();
+    return _def->getSWFVersion();
 }
 
 static as_object*

=== modified file 'libcore/Button.h'
--- a/libcore/Button.h  2009-04-05 08:55:10 +0000
+++ b/libcore/Button.h  2009-04-15 09:08:37 +0000
@@ -70,7 +70,8 @@
                HIT
        };
 
-       Button(SWF::DefineButtonTag& def, DisplayObject* parent, int id);
+       Button(const SWF::DefineButtonTag* const def, DisplayObject* parent,
+            int id);
 
        ~Button();
        
@@ -165,7 +166,7 @@
 
        MouseState m_mouse_state;
     
-    SWF::DefineButtonTag& _def;
+    const boost::intrusive_ptr<const SWF::DefineButtonTag> _def;
 
        DisplayObjects _stateCharacters;
 

=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2009-04-14 07:33:24 +0000
+++ b/libcore/Video.cpp 2009-04-15 09:08:37 +0000
@@ -52,7 +52,7 @@
     as_value video_height(const fn_call& fn);
 }
 
-Video::Video(SWF::DefineVideoStreamTag* def,
+Video::Video(const SWF::DefineVideoStreamTag* const def,
                DisplayObject* parent, int id)
        :
        DisplayObject(parent, id),

=== modified file 'libcore/Video.h'
--- a/libcore/Video.h   2009-04-03 11:03:31 +0000
+++ b/libcore/Video.h   2009-04-15 09:08:37 +0000
@@ -48,7 +48,7 @@
 
 public:
        
-       Video(SWF::DefineVideoStreamTag* def, DisplayObject* parent,
+       Video(const SWF::DefineVideoStreamTag* const def, DisplayObject* parent,
             int id);
 
        ~Video();
@@ -127,7 +127,7 @@
        /// Get video frame to be displayed
        GnashImage* getVideoFrame();
 
-       const boost::intrusive_ptr<SWF::DefineVideoStreamTag> m_def;
+       const boost::intrusive_ptr<const SWF::DefineVideoStreamTag> m_def;
 
     // Who owns this ? Should it be an intrusive ptr ?
        boost::intrusive_ptr<NetStream_as> _ns;

=== modified file 'libcore/parser/BitmapMovieDefinition.cpp'
--- a/libcore/parser/BitmapMovieDefinition.cpp  2009-04-15 05:33:51 +0000
+++ b/libcore/parser/BitmapMovieDefinition.cpp  2009-04-15 09:08:37 +0000
@@ -32,18 +32,33 @@
 Movie*
 BitmapMovieDefinition::createMovie(DisplayObject* parent)
 {
-    // It's possible for this to fail.
-    if (!_bitmap.get()) return 0;
+    return new BitmapMovie(this, parent);
+}
+
+BitmapMovieDefinition::BitmapMovieDefinition(std::auto_ptr<GnashImage> image,
+               const std::string& url)
+       :
+       _version(6),
+       _framesize(0, 0, image->width()*20, image->height()*20),
+       _framecount(1),
+       _framerate(12),
+       _url(url),
+       _bytesTotal(image->size()),
+       _bitmap(render::createBitmapInfo(image))
+{
+
+    if (!_bitmap.get()) return;
+
+    _shape.reset(new DynamicShape);
 
        // Set its boundaries
-       _shape.setBounds(_framesize);
+       _shape->setBounds(_framesize);
 
        // Add the bitmap fill style (fill style 0)
-
        SWFMatrix mat;
        mat.set_scale(1.0/20, 1.0/20); // bitmap fills get SWFMatrix reversed
        fill_style bmFill(_bitmap.get(), mat);
-       const size_t fillLeft = _shape.add_fill_style(bmFill);
+       const size_t fillLeft = _shape->add_fill_style(bmFill);
 
        // Define a rectangle filled with the bitmap style
 
@@ -65,23 +80,17 @@
        bmPath.drawLineTo(w, h);
 
        // Add the path 
-
-       _shape.add_path(bmPath);
-
-    return new BitmapMovie(this, parent);
+       _shape->add_path(bmPath);
+
 }
 
-BitmapMovieDefinition::BitmapMovieDefinition(std::auto_ptr<GnashImage> image,
-               const std::string& url)
-       :
-       _version(6),
-       _framesize(0, 0, image->width()*20, image->height()*20),
-       _framecount(1),
-       _framerate(12),
-       _url(url),
-       _bytesTotal(image->size()),
-       _bitmap(render::createBitmapInfo(image))
+DisplayObject*
+BitmapMovieDefinition::createDisplayObject(DisplayObject* parent, int id) const
 {
+    // It's possible for this to fail.
+    if (!_shape.get()) return 0;
+    
+    return new Shape(_shape, parent, id);
 }
 
 #ifdef GNASH_USE_GC

=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h    2009-04-15 07:01:39 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h    2009-04-15 09:08:37 +0000
@@ -57,13 +57,7 @@
        BitmapMovieDefinition(std::auto_ptr<GnashImage> image,
             const std::string& url);
 
-    /// This is currently useless
-    //
-    /// TODO: For AVM2, it may be used to create a Bitmap DisplayObject
-    /// instead of a Movie when used from the Loader class.
-    virtual DisplayObject* createDisplayObject(DisplayObject*, int) {
-        return 0;
-    }
+    virtual DisplayObject* createDisplayObject(DisplayObject*, int) const;
 
        virtual int     get_version() const {
                return _version;
@@ -122,10 +116,6 @@
                return 1;
        }
 
-    const DynamicShape& shape() const {
-        return _shape;
-    }
-
 protected:
 
 #ifdef GNASH_USE_GC
@@ -150,7 +140,7 @@
 
     boost::intrusive_ptr<BitmapInfo> _bitmap;
 
-    DynamicShape _shape;
+    boost::shared_ptr<DynamicShape> _shape;
 
 };
 

=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h       2009-04-15 06:22:17 +0000
+++ b/libcore/parser/SWFMovieDefinition.h       2009-04-15 09:08:37 +0000
@@ -382,7 +382,7 @@
        ///
        Movie* createMovie(DisplayObject* parent=0);
 
-    virtual DisplayObject* createDisplayObject(DisplayObject*, int) {
+    virtual DisplayObject* createDisplayObject(DisplayObject*, int) const {
         return 0;
     }
 

=== modified file 'libcore/parser/sprite_definition.cpp'
--- a/libcore/parser/sprite_definition.cpp      2009-04-15 06:02:24 +0000
+++ b/libcore/parser/sprite_definition.cpp      2009-04-15 09:08:37 +0000
@@ -40,7 +40,7 @@
 namespace gnash {
 
 DisplayObject*
-sprite_definition::createDisplayObject(DisplayObject* parent, int id)
+sprite_definition::createDisplayObject(DisplayObject* parent, int id) const
 {
 #ifdef DEBUG_REGISTER_CLASS
        log_debug(_("Instantiating sprite_def %p"), (void*)this);

=== modified file 'libcore/parser/sprite_definition.h'
--- a/libcore/parser/sprite_definition.h        2009-04-15 06:02:24 +0000
+++ b/libcore/parser/sprite_definition.h        2009-04-15 09:08:37 +0000
@@ -232,7 +232,8 @@
        // the parent movie's display list.
        //
        // overloads from SWF::DefinitionTag
-       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id);
+       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id)
+        const;
 
 
 private:

=== modified file 'libcore/swf/DefineButtonTag.cpp'
--- a/libcore/swf/DefineButtonTag.cpp   2009-04-07 12:46:29 +0000
+++ b/libcore/swf/DefineButtonTag.cpp   2009-04-15 09:08:37 +0000
@@ -415,9 +415,9 @@
 
 
 DisplayObject*
-DefineButtonTag::createDisplayObject(DisplayObject* parent, int id)
+DefineButtonTag::createDisplayObject(DisplayObject* parent, int id) const
 {
-       DisplayObject* ch = new Button(*this, parent, id);
+       DisplayObject* ch = new Button(this, parent, id);
        return ch;
 }
 

=== modified file 'libcore/swf/DefineButtonTag.h'
--- a/libcore/swf/DefineButtonTag.h     2009-04-14 07:00:59 +0000
+++ b/libcore/swf/DefineButtonTag.h     2009-04-15 09:08:37 +0000
@@ -192,11 +192,14 @@
        virtual ~DefineButtonTag();
 
        /// Create a mutable instance of our definition.
-       DisplayObject* createDisplayObject(DisplayObject* parent, int id);
+       DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
 
     /// Access the ButtonRecords directly. Used for modifying the
     /// Cxform by a DefineButtonCxform tag.
     ButtonRecords& buttonRecords() { return _buttonRecords; }
+    
+    /// Read-only access to the ButtonRecords directly. 
+    const ButtonRecords& buttonRecords() const { return _buttonRecords; }
 
     /// Does this button have an associated DefineButtonSoundTag?
     bool hasSound() const { return (_soundTag.get()); }

=== modified file 'libcore/swf/DefineEditTextTag.cpp'
--- a/libcore/swf/DefineEditTextTag.cpp 2009-04-03 09:48:13 +0000
+++ b/libcore/swf/DefineEditTextTag.cpp 2009-04-15 09:08:37 +0000
@@ -39,7 +39,7 @@
 }
 
 DisplayObject*
-DefineEditTextTag::createDisplayObject(DisplayObject* parent, int id)
+DefineEditTextTag::createDisplayObject(DisplayObject* parent, int id) const
 {
        // Resolve the font, if possible
        getFont();

=== modified file 'libcore/swf/DefineEditTextTag.h'
--- a/libcore/swf/DefineEditTextTag.h   2009-04-14 07:33:24 +0000
+++ b/libcore/swf/DefineEditTextTag.h   2009-04-15 09:08:37 +0000
@@ -67,7 +67,7 @@
 
     const rect& bounds() const { return _rect; }
 
-    DisplayObject* createDisplayObject(DisplayObject* parent, int id);
+    DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
 
        /// Return a reference to the default text associated
        /// with this EditText definition.

=== modified file 'libcore/swf/DefineMorphShapeTag.cpp'
--- a/libcore/swf/DefineMorphShapeTag.cpp       2009-04-07 14:32:06 +0000
+++ b/libcore/swf/DefineMorphShapeTag.cpp       2009-04-15 09:08:37 +0000
@@ -55,7 +55,7 @@
 }
 
 DisplayObject*
-DefineMorphShapeTag::createDisplayObject(DisplayObject* parent, int id)
+DefineMorphShapeTag::createDisplayObject(DisplayObject* parent, int id) const
 {
     return new MorphShape(this, parent, id);
 }

=== modified file 'libcore/swf/DefineMorphShapeTag.h'
--- a/libcore/swf/DefineMorphShapeTag.h 2009-04-14 07:00:59 +0000
+++ b/libcore/swf/DefineMorphShapeTag.h 2009-04-15 09:08:37 +0000
@@ -48,7 +48,8 @@
 
     virtual ~DefineMorphShapeTag() {}
 
-       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id);
+       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id)
+        const;
 
     virtual void display(const MorphShape& inst) const;
 

=== modified file 'libcore/swf/DefineShapeTag.cpp'
--- a/libcore/swf/DefineShapeTag.cpp    2009-04-07 13:07:42 +0000
+++ b/libcore/swf/DefineShapeTag.cpp    2009-04-15 09:08:37 +0000
@@ -64,7 +64,7 @@
 }
 
 DisplayObject*
-DefineShapeTag::createDisplayObject(DisplayObject* parent, int id)
+DefineShapeTag::createDisplayObject(DisplayObject* parent, int id) const
 {
        return new Shape(this, parent, id);
 }

=== modified file 'libcore/swf/DefineShapeTag.h'
--- a/libcore/swf/DefineShapeTag.h      2009-04-14 07:33:24 +0000
+++ b/libcore/swf/DefineShapeTag.h      2009-04-15 09:08:37 +0000
@@ -40,7 +40,8 @@
     virtual void display(const DisplayObject& inst) const;
 
     // Create a Shape DisplayObject.
-       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id);
+       virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id)
+        const;
        
     /// Get cached bounds of this shape.
     const rect& bounds() const { return _shape.getBounds(); }

=== modified file 'libcore/swf/DefineTextTag.cpp'
--- a/libcore/swf/DefineTextTag.cpp     2009-04-09 06:17:15 +0000
+++ b/libcore/swf/DefineTextTag.cpp     2009-04-15 09:08:37 +0000
@@ -40,7 +40,7 @@
 }
 
 DisplayObject*
-DefineTextTag::createDisplayObject(DisplayObject* parent, int id)
+DefineTextTag::createDisplayObject(DisplayObject* parent, int id) const
 {
     return new StaticText(this, parent, id);
 }

=== modified file 'libcore/swf/DefineTextTag.h'
--- a/libcore/swf/DefineTextTag.h       2009-04-14 07:33:24 +0000
+++ b/libcore/swf/DefineTextTag.h       2009-04-15 09:08:37 +0000
@@ -67,7 +67,8 @@
     bool extractStaticText(std::vector<const TextRecord*>& to, size_t& size)
         const;
 
-    virtual DisplayObject* createDisplayObject(DisplayObject* parent, int id);
+    virtual DisplayObject* createDisplayObject(DisplayObject* parent, int id)
+        const;
 
 private:
 

=== modified file 'libcore/swf/DefineVideoStreamTag.cpp'
--- a/libcore/swf/DefineVideoStreamTag.cpp      2009-04-03 09:48:13 +0000
+++ b/libcore/swf/DefineVideoStreamTag.cpp      2009-04-15 09:08:37 +0000
@@ -133,7 +133,7 @@
 }
 
 DisplayObject*
-DefineVideoStreamTag::createDisplayObject(DisplayObject* parent, int id)
+DefineVideoStreamTag::createDisplayObject(DisplayObject* parent, int id) const
 {
        DisplayObject* ch = new Video(this, parent, id);
        return ch;
@@ -148,17 +148,17 @@
 
 void
 DefineVideoStreamTag::getEncodedFrameSlice(boost::uint32_t from,
-        boost::uint32_t to, EmbeddedFrames& ret)
+        boost::uint32_t to, EmbeddedFrames& ret) const
 {
        assert(from<=to);
 
        boost::mutex::scoped_lock lock(_video_mutex);
 
     // It's assumed that frame numbers are in order.
-    EmbeddedFrames::iterator lower = std::lower_bound(
+    EmbeddedFrames::const_iterator lower = std::lower_bound(
             _video_frames.begin(), _video_frames.end(), from, FrameFinder());
 
-    EmbeddedFrames::iterator upper = std::upper_bound(
+    EmbeddedFrames::const_iterator upper = std::upper_bound(
             lower, _video_frames.end(), to, FrameFinder());
 
     // This copies a pointer to the encoded video frames; the actual

=== modified file 'libcore/swf/DefineVideoStreamTag.h'
--- a/libcore/swf/DefineVideoStreamTag.h        2009-04-14 07:33:24 +0000
+++ b/libcore/swf/DefineVideoStreamTag.h        2009-04-15 09:08:37 +0000
@@ -83,7 +83,7 @@
 
        ~DefineVideoStreamTag();
 
-       DisplayObject* createDisplayObject(DisplayObject* parent, int id);
+       DisplayObject* createDisplayObject(DisplayObject* parent, int id) const;
 
        /// Read tag SWF::DEFINEVIDEOSTREAM 
        //
@@ -117,7 +117,7 @@
        /// May return NULL if there's no embedded video
        /// (ActionScript created definition - new Video)
        ///
-       media::VideoInfo* getVideoInfo() { return _videoInfo.get(); }
+       media::VideoInfo* getVideoInfo() const { return _videoInfo.get(); }
 
        /// Get a slice of encoded video frames
        //
@@ -136,7 +136,7 @@
        ///       are 0,3,6
        ///
        void getEncodedFrameSlice(boost::uint32_t from, boost::uint32_t to,
-               std::vector<media::EncodedVideoFrame*>& ret);
+               std::vector<media::EncodedVideoFrame*>& ret) const;
 
     
     void addVideoFrameTag(std::auto_ptr<media::EncodedVideoFrame> frame);
@@ -191,7 +191,8 @@
        /// Bounds of the video, as read from the DEFINEVIDEOSTREAM tag.
        rect m_bound;
 
-       boost::mutex _video_mutex;
+    // Mutable for locking in const member functions.
+       mutable boost::mutex _video_mutex;
        
        EmbeddedFrames _video_frames;
 

=== modified file 'libcore/swf/DefinitionTag.h'
--- a/libcore/swf/DefinitionTag.h       2009-04-14 07:00:59 +0000
+++ b/libcore/swf/DefinitionTag.h       2009-04-15 09:08:37 +0000
@@ -51,7 +51,7 @@
     /// DefinitionTag and adds it as a child of the specified parent
     /// DisplayObject.
        virtual DisplayObject* createDisplayObject(DisplayObject* parent,
-            int id) = 0;
+            int id) const = 0;
        
 };
 


reply via email to

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