gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. e302d193c39d8556a793


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. e302d193c39d8556a7936d291a1063adcb289997
Date: Sun, 12 Dec 2010 13:39:00 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  e302d193c39d8556a7936d291a1063adcb289997 (commit)
       via  d84299ed464870dfd1cc0b9c406677c717d7e19b (commit)
       via  b4b63fc7730df34a8637ed1d4aee91295e6eaf03 (commit)
       via  92c42f9c9ead299674e1152c5756ebe29cdd5bb3 (commit)
       via  1db16ebb101a2979bf91b92f6efe2ed5f61dd59d (commit)
       via  402d6167cdfc1af9fa14f64e42b9c8ded8fb6bb1 (commit)
       via  1f1132e53161ce5ba5229f4b3831bed6eb6ce985 (commit)
       via  7e375826ae20434868c12a6600c87df51d207836 (commit)
       via  f92ab79a3a3709977f3915b348569fa5e53727fb (commit)
       via  11a59ae46ed3b57f771dcc8ae1ed6c910a813aad (commit)
       via  74a9d995b54fc6541d87d753d8266f1cf1ef6988 (commit)
       via  0cd106083f779a0366d6587e2478ef51f5d65c6c (commit)
       via  450d11590212b474b4439bc7abf279faa4c339a7 (commit)
      from  94d6d1d8d80b0e7aee1ab678c3959d13ef5ade79 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=e302d193c39d8556a7936d291a1063adcb289997


commit e302d193c39d8556a7936d291a1063adcb289997
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 14:37:06 2010 +0100

    Drop unneeded include again.

diff --git a/libcore/swf/DefineVideoStreamTag.cpp 
b/libcore/swf/DefineVideoStreamTag.cpp
index 750225b..0822c29 100644
--- a/libcore/swf/DefineVideoStreamTag.cpp
+++ b/libcore/swf/DefineVideoStreamTag.cpp
@@ -18,7 +18,6 @@
 
 #include "DefineVideoStreamTag.h"
 
-#include <boost/type_traits.hpp>
 #include <boost/shared_array.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>

http://git.savannah.gnu.org/cgit//commit/?id=d84299ed464870dfd1cc0b9c406677c717d7e19b


commit d84299ed464870dfd1cc0b9c406677c717d7e19b
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 14:22:37 2010 +0100

    Store unsigned values as unsigned to avoid the proliferation of
    silly checks throughout the code.

diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index 87d036f..6831aa7 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -312,7 +312,7 @@ DisplayList::replaceDisplayObject(DisplayObject* ch, int 
depth,
 // the specified depth.
 void
 DisplayList::moveDisplayObject( int depth, const SWFCxForm* color_xform,
-        const SWFMatrix* mat, int* ratio, int* /* clip_depth */)
+        const SWFMatrix* mat, boost::uint16_t* ratio)
 {
     testInvariant();
 
diff --git a/libcore/DisplayList.h b/libcore/DisplayList.h
index a1ffc03..3cdfe77 100644
--- a/libcore/DisplayList.h
+++ b/libcore/DisplayList.h
@@ -155,12 +155,8 @@ public:
        /// @param ratio
        /// The new ratio value to assign to the DisplayObject at the given 
depth.
        /// If NULL the original ratio will be kept.
-       ///
-       /// @clip_depth
-       /// Not used at the moment.
-       /// 
-       void moveDisplayObject( int depth, const SWFCxForm* color_xform,
-            const SWFMatrix* mat, int* ratio, int* clip_depth);
+       void moveDisplayObject(int depth, const SWFCxForm* color_xform,
+            const SWFMatrix* mat, boost::uint16_t* ratio);
 
        /// Removes the object at the specified depth.
        //
diff --git a/libcore/DisplayObject.h b/libcore/DisplayObject.h
index dc8cfd2..1138abf 100644
--- a/libcore/DisplayObject.h
+++ b/libcore/DisplayObject.h
@@ -356,9 +356,9 @@ public:
         }
     }
 
-    int get_ratio() const { return _ratio; }
+    boost::uint16_t get_ratio() const { return _ratio; }
 
-    void set_ratio(int r) {
+    void set_ratio(boost::uint16_t r) {
         if (r != _ratio) set_invalidated(); 
         _ratio = r;       
     }
@@ -1063,7 +1063,7 @@ private:
     ///
     int _volume;
 
-    int _ratio;
+    boost::uint16_t _ratio;
     int m_clip_depth;
 
     /// The DisplayObject masking this instance (if any)
diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 5c240d1..20d9f69 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -1235,14 +1235,13 @@ MovieClip::add_display_object(const 
SWF::PlaceObject2Tag* tag,
 void 
 MovieClip::move_display_object(const SWF::PlaceObject2Tag* tag, DisplayList& 
dlist)
 {    
-    int ratio = tag->getRatio();
+    boost::uint16_t ratio = tag->getRatio();
     // clip_depth is not used in MOVE tag(at least no related tests). 
     dlist.moveDisplayObject(
         tag->getDepth(), 
         tag->hasCxform() ? &tag->getCxform() : NULL,
         tag->hasMatrix() ? &tag->getMatrix() : NULL,
-        tag->hasRatio() ? &ratio : NULL,
-        NULL);
+        tag->hasRatio() ? &ratio : NULL);
 }
 
 void
diff --git a/libcore/Video.cpp b/libcore/Video.cpp
index 9397682..5f54238 100644
--- a/libcore/Video.cpp
+++ b/libcore/Video.cpp
@@ -142,7 +142,7 @@ Video::getVideoFrame()
     // frame from there.
        if (_ns) {
                std::auto_ptr<image::GnashImage> tmp = _ns->get_video();
-               if ( tmp.get() ) _lastDecodedVideoFrame = tmp;
+               if (tmp.get()) _lastDecodedVideoFrame = tmp;
        }
 
        // If this is a video from a VideoFrame tag, retrieve a video frame
@@ -157,8 +157,7 @@ Video::getVideoFrame()
             return _lastDecodedVideoFrame.get();
         }
 
-               int current_frame = get_ratio(); 
-        assert(current_frame >= 0);
+        const boost::uint16_t current_frame = get_ratio(); 
 
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                log_debug("Video instance %s need display video frame (ratio) 
%d",
@@ -167,7 +166,8 @@ Video::getVideoFrame()
 
                // If current frame is the same then last decoded
                // we don't need to decode more
-               if (_lastDecodedVideoFrameNum == current_frame) {
+               if (_lastDecodedVideoFrameNum >= 0 &&
+                _lastDecodedVideoFrameNum == current_frame) {
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                        log_debug("  current frame == _lastDecodedVideoFrameNum 
(%d)",
                     current_frame);
@@ -175,12 +175,14 @@ Video::getVideoFrame()
                        return _lastDecodedVideoFrame.get();
                }
 
-               int from_frame = _lastDecodedVideoFrameNum < 0 ?
-            0 : _lastDecodedVideoFrameNum + 1;
+        // TODO: find a better way than using -1 to show that no
+        // frames have been decoded yet.
+        assert(_lastDecodedVideoFrameNum >= -1);
+        boost::uint16_t from_frame = _lastDecodedVideoFrameNum + 1;
 
                // If current frame is smaller then last decoded frame
                // we restart decoding from scratch
-               if (current_frame < _lastDecodedVideoFrameNum) {
+               if (current_frame < 
static_cast<size_t>(_lastDecodedVideoFrameNum)) {
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                        log_debug("  current frame (%d) < 
_lastDecodedVideoFrameNum (%d)",
                     current_frame, _lastDecodedVideoFrameNum);
@@ -198,7 +200,8 @@ Video::getVideoFrame()
 #endif
 
         const size_t frames = m_def->visitSlice(
-                boost::bind(boost::mem_fn(&media::VideoDecoder::push), 
_decoder.get(), _1),
+                boost::bind(boost::mem_fn(&media::VideoDecoder::push),
+                    _decoder.get(), _1),
                 from_frame, current_frame);
 
         if (!frames) return _lastDecodedVideoFrame.get();
@@ -224,7 +227,7 @@ Video::add_invalidated_bounds(InvalidatedRanges& ranges, 
bool force)
     
        ranges.add(m_old_invalidated_ranges);
        
-       assert (m_def);
+       assert(m_def);
 
        SWFRect bounds; 
        bounds.expand_to_transformed_rect(getWorldMatrix(*this), 
m_def->bounds());
diff --git a/libcore/swf/PlaceObject2Tag.h b/libcore/swf/PlaceObject2Tag.h
index efdc142..754721e 100644
--- a/libcore/swf/PlaceObject2Tag.h
+++ b/libcore/swf/PlaceObject2Tag.h
@@ -105,7 +105,7 @@ public:
         return m_has_flags2 & (HAS_CHARACTER_MASK | MOVE_MASK);
     } 
 
-    int getRatio() const { return _ratio; }
+    boost::uint16_t getRatio() const { return _ratio; }
     int getClipDepth() const { return m_clip_depth; }
     boost::uint16_t getID() const { return _id; }
     const std::string& getName() const { return m_name; }
@@ -166,7 +166,7 @@ private:
     boost::uint16_t _id;
     SWFCxForm  m_color_transform;
     SWFMatrix  m_matrix;
-    int     _ratio;
+    boost::uint16_t _ratio;
     std::string m_name;
     int     m_clip_depth;
     

http://git.savannah.gnu.org/cgit//commit/?id=b4b63fc7730df34a8637ed1d4aee91295e6eaf03


commit b4b63fc7730df34a8637ed1d4aee91295e6eaf03
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 14:07:04 2010 +0100

    Const correct.

diff --git a/libcore/Video.cpp b/libcore/Video.cpp
index 3fe13da..9397682 100644
--- a/libcore/Video.cpp
+++ b/libcore/Video.cpp
@@ -153,7 +153,7 @@ Video::getVideoFrame()
         // never constructed (most likely), we'll return nothing,
         // otherwise the last decoded frame.
         if (!_decoder.get()) {
-                   LOG_ONCE( log_error(_("No Video info in video definition")) 
);
+                   LOG_ONCE(log_error(_("No Video info in video definition")));
             return _lastDecodedVideoFrame.get();
         }
 
@@ -180,8 +180,7 @@ Video::getVideoFrame()
 
                // If current frame is smaller then last decoded frame
                // we restart decoding from scratch
-               if ( current_frame < _lastDecodedVideoFrameNum )
-               {
+               if (current_frame < _lastDecodedVideoFrameNum) {
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                        log_debug("  current frame (%d) < 
_lastDecodedVideoFrameNum (%d)",
                     current_frame, _lastDecodedVideoFrameNum);
@@ -198,7 +197,7 @@ Video::getVideoFrame()
                 "object %s", from_frame, current_frame, getTarget());
 #endif
 
-        size_t frames = m_def->visitSlice(
+        const size_t frames = m_def->visitSlice(
                 boost::bind(boost::mem_fn(&media::VideoDecoder::push), 
_decoder.get(), _1),
                 from_frame, current_frame);
 

http://git.savannah.gnu.org/cgit//commit/?id=92c42f9c9ead299674e1152c5756ebe29cdd5bb3


commit 92c42f9c9ead299674e1152c5756ebe29cdd5bb3
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 13:57:06 2010 +0100

    Const correct, hide implementation, use ptr_containers.

diff --git a/libcore/Video.cpp b/libcore/Video.cpp
index 9ec56bf..3fe13da 100644
--- a/libcore/Video.cpp
+++ b/libcore/Video.cpp
@@ -18,9 +18,12 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
+#include "Video.h"
+
+#include <boost/bind.hpp>
+#include <cassert>
 
 #include "MovieClip.h"
-#include "Video.h"
 #include "DefineVideoStreamTag.h"
 #include "fn_call.h"
 #include "as_value.h"
@@ -135,20 +138,16 @@ Video::display(Renderer& renderer, const Transform& base)
 image::GnashImage*
 Video::getVideoFrame()
 {
-
-
        // If this is a video from a NetStream_as object, retrieve a video
     // frame from there.
-       if (_ns)
-       {
+       if (_ns) {
                std::auto_ptr<image::GnashImage> tmp = _ns->get_video();
                if ( tmp.get() ) _lastDecodedVideoFrame = tmp;
        }
 
        // If this is a video from a VideoFrame tag, retrieve a video frame
     // from there.
-       else if (_embeddedStream)
-       {
+       else if (_embeddedStream) {
 
         // Don't try to do anything if there is no decoder. If it was
         // never constructed (most likely), we'll return nothing,
@@ -159,6 +158,7 @@ Video::getVideoFrame()
         }
 
                int current_frame = get_ratio(); 
+        assert(current_frame >= 0);
 
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                log_debug("Video instance %s need display video frame (ratio) 
%d",
@@ -167,8 +167,7 @@ Video::getVideoFrame()
 
                // If current frame is the same then last decoded
                // we don't need to decode more
-               if ( _lastDecodedVideoFrameNum == current_frame )
-               {
+               if (_lastDecodedVideoFrameNum == current_frame) {
 #ifdef DEBUG_EMBEDDED_VIDEO_DECODING
                        log_debug("  current frame == _lastDecodedVideoFrameNum 
(%d)",
                     current_frame);
@@ -199,29 +198,11 @@ Video::getVideoFrame()
                 "object %s", from_frame, current_frame, getTarget());
 #endif
 
-               typedef SWF::DefineVideoStreamTag::EmbeddedFrames EncodedFrames;
+        size_t frames = m_def->visitSlice(
+                boost::bind(boost::mem_fn(&media::VideoDecoder::push), 
_decoder.get(), _1),
+                from_frame, current_frame);
 
-               EncodedFrames toDecode;
-               m_def->getEncodedFrameSlice(from_frame, current_frame, 
toDecode);
-
-               // Nothing more to decode, return last decoded (possibly null)
-               if ( toDecode.empty() )
-               {
-#ifdef DEBUG_EMBEDDED_VIDEO_DECODING
-                       log_debug("    no defined frames, we'll return last 
one");
-#endif
-                       return _lastDecodedVideoFrame.get();
-               }
-
-               for (EncodedFrames::iterator it=toDecode.begin(),
-                itEnd=toDecode.end(); it!=itEnd; ++it)
-               {
-                       media::EncodedVideoFrame* frame = *it;
-#ifdef DEBUG_EMBEDDED_VIDEO_DECODING
-                       log_debug("    pushing frame %d to decoder", 
frame->frameNum());
-#endif
-                       _decoder->push(*frame);
-               }
+        if (!frames) return _lastDecodedVideoFrame.get();
 
                _lastDecodedVideoFrame = _decoder->pop();
        }
diff --git a/libcore/Video.h b/libcore/Video.h
index 7b1c97a..c6554cf 100644
--- a/libcore/Video.h
+++ b/libcore/Video.h
@@ -16,17 +16,16 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-
 #ifndef GNASH_VIDEO_H
 #define GNASH_VIDEO_H
 
 #include <boost/intrusive_ptr.hpp>
-#include "DisplayObject.h" // for inheritance
+#include "DisplayObject.h"
 
 // Forward declarations
 namespace gnash {
        class NetStream_as;
+    class Global_as;
     namespace image {
         class GnashImage;
     }
@@ -49,7 +48,6 @@ namespace gnash {
 ///
 class Video : public DisplayObject
 {
-
 public:
        
        Video(as_object* object, const SWF::DefineVideoStreamTag* def,
diff --git a/libcore/swf/DefineVideoStreamTag.cpp 
b/libcore/swf/DefineVideoStreamTag.cpp
index 67b5904..750225b 100644
--- a/libcore/swf/DefineVideoStreamTag.cpp
+++ b/libcore/swf/DefineVideoStreamTag.cpp
@@ -16,47 +16,27 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
+#include "DefineVideoStreamTag.h"
+
+#include <boost/type_traits.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory> 
+#include <vector> 
 
 #include "RunResources.h"
-#include "DefineVideoStreamTag.h"
 #include "Video.h"
 #include "MediaParser.h" // for VideoInfo
 #include "VideoDecoder.h"
 #include "SWFStream.h" // for read()
 #include "movie_definition.h"
-#include "GnashAlgorithm.h"
 #include "GnashNumeric.h"
 #include "Global_as.h"
 
 namespace gnash {
 namespace SWF {
 
-namespace {
-
-/// A Functor for comparing frames by frame number.
-//
-/// A comparison operator would avoid having two variants, but seems less
-/// intuitive, and could open up all sorts of unexpected behaviour due to
-/// type promotion.
-struct FrameFinder
-{
-
-    typedef DefineVideoStreamTag::EmbeddedFrames::value_type Frame;
-
-    bool operator()(const Frame& frame, size_t i)
-    {
-        return frame->frameNum() < i;
-    }
-    
-    bool operator()(size_t i, const Frame& frame)
-    {
-        return i < frame->frameNum();
-    }
-};
-
-}
-
 DefineVideoStreamTag::DefineVideoStreamTag(SWFStream& in, boost::uint16_t id)
        :
     DefinitionTag(id),
@@ -68,7 +48,6 @@ DefineVideoStreamTag::DefineVideoStreamTag(SWFStream& in, 
boost::uint16_t id)
 
 DefineVideoStreamTag::~DefineVideoStreamTag()
 {
-    deleteChecked(_video_frames.begin(), _video_frames.end());
 }
 
 
@@ -93,8 +72,6 @@ DefineVideoStreamTag::read(SWFStream& in)
 
        assert(!_videoInfo.get()); // allowed to be called only once
 
-       //m_start_frame = m->get_loading_frame();
-
        // numFrames:2 width:2 height:2 flags:1
        in.ensureBytes(8);
 
@@ -132,42 +109,18 @@ DefineVideoStreamTag::addVideoFrameTag(
         std::auto_ptr<media::EncodedVideoFrame> frame)
 {
        boost::mutex::scoped_lock lock(_video_mutex);
-
-    _video_frames.push_back(frame.release());
+    _video_frames.push_back(frame);
 }
 
 DisplayObject*
 DefineVideoStreamTag::createDisplayObject(Global_as& gl,
         DisplayObject* parent) const
 {
-
     as_object* obj = createVideoObject(gl);
        DisplayObject* ch = new Video(obj, this, parent);
        return ch;
 }
 
-void
-DefineVideoStreamTag::getEncodedFrameSlice(boost::uint32_t from,
-        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::const_iterator lower = std::lower_bound(
-            _video_frames.begin(), _video_frames.end(), from, FrameFinder());
-
-    EmbeddedFrames::const_iterator upper = std::upper_bound(
-            lower, _video_frames.end(), to, FrameFinder());
-
-    // This copies a pointer to the encoded video frames; the actual
-    // data is owned by this class for its entire lifetime.
-    std::copy(lower, upper, std::back_inserter(ret));
-}
-
-
-
 } // namespace SWF
 } // namespace gnash
 
diff --git a/libcore/swf/DefineVideoStreamTag.h 
b/libcore/swf/DefineVideoStreamTag.h
index cd6a327..b7cda2d 100644
--- a/libcore/swf/DefineVideoStreamTag.h
+++ b/libcore/swf/DefineVideoStreamTag.h
@@ -19,17 +19,17 @@
 #ifndef GNASH_SWF_DEFINEVIDEOSTREAMTAG_H
 #define GNASH_SWF_DEFINEVIDEOSTREAMTAG_H
 
+#include <boost/shared_array.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory> 
+#include <vector> 
+
 #include "DefinitionTag.h"
 #include "SWF.h"
 #include "SWFRect.h" // for composition
 #include "MediaParser.h" // for videoFrameType and videoCodecType enums
 
-#include <boost/shared_array.hpp>
-#include <boost/thread/mutex.hpp>
-
-#include <memory> // for composition (auto_ptr)
-#include <vector> // for composition
-
 // Forward declarations
 namespace gnash {
     class movie_definition;
@@ -66,15 +66,32 @@ namespace SWF {
 
 class DefineVideoStreamTag : public DefinitionTag
 {
-public:
        
-    /// The undecoded video frames and its size, using the swf-frame number
-    /// as key
+    /// The undecoded video frames, using the swf-frame number as key
        //
        /// Elements of this vector are owned by this instance, and will be 
deleted 
        /// at instance destruction time.
-       ///
-       typedef std::vector<media::EncodedVideoFrame*> EmbeddedFrames;
+       typedef boost::ptr_vector<media::EncodedVideoFrame> EmbeddedFrames;
+
+    /// A Functor for comparing frames by frame number.
+    //
+    /// A comparison operator would avoid having two variants, but seems less
+    /// intuitive, and could open up all sorts of unexpected behaviour due to
+    /// type promotion.
+    struct FrameFinder
+    {
+        typedef EmbeddedFrames::const_reference Frame;
+
+        bool operator()(Frame frame, size_t i) const {
+            return frame.frameNum() < i;
+        }
+        
+        bool operator()(size_t i, Frame frame) const {
+            return i < frame.frameNum();
+        }
+    };
+
+public:
 
        ~DefineVideoStreamTag();
 
@@ -103,8 +120,7 @@ public:
             movie_definition& m);
 
        /// Return local video bounds in twips
-       const SWFRect&  bounds() const
-       {
+       const SWFRect& bounds() const {
                return m_bound;
        }
 
@@ -115,25 +131,27 @@ public:
        ///
        media::VideoInfo* getVideoInfo() const { return _videoInfo.get(); }
 
-       /// Get a slice of encoded video frames
+       /// Visit a slice of encoded video frames
        //
-       /// @param from
-       ///     Frame number of first frame to get
-       /// 
-       /// @param to
-       ///     Frame number of last frame to get
-       ///
-       /// @param ret
-       ///     The vector to push defined elements onto. Ownership of elements
-       ///     is left to callee.
-       ///
-       /// NOTE: video definition can have gaps, so you may get NO frames
-       ///       if you ask for frames from 1 to 2 when available frames
-       ///       are 0,3,6
-       ///
-       void getEncodedFrameSlice(boost::uint32_t from, boost::uint32_t to,
-               std::vector<media::EncodedVideoFrame*>& ret) const;
+       /// @param from     Frame number of first frame to get
+       /// @param to       Frame number of last frame to get
+    /// @tparam t       A visitor that should accept a const
+    ///                 media::EncodedVideoFrame.
+    template<typename T>
+    size_t visitSlice(const T& t, boost::uint32_t from, boost::uint32_t to) 
const {
+
+        boost::mutex::scoped_lock lock(_video_mutex);
+
+        // It's assumed that frame numbers are in order.
+        EmbeddedFrames::const_iterator lower = std::lower_bound(
+                _video_frames.begin(), _video_frames.end(), from, 
FrameFinder());
+
+        EmbeddedFrames::const_iterator upper = std::upper_bound(
+                lower, _video_frames.end(), to, FrameFinder());
 
+        std::for_each(lower, upper, t);
+        return (upper - lower);
+    }
     
     void addVideoFrameTag(std::auto_ptr<media::EncodedVideoFrame> frame);
 
diff --git a/libcore/swf/VideoFrameTag.cpp b/libcore/swf/VideoFrameTag.cpp
index c3b9a02..0f10556 100644
--- a/libcore/swf/VideoFrameTag.cpp
+++ b/libcore/swf/VideoFrameTag.cpp
@@ -16,9 +16,11 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+#include "DefineVideoStreamTag.h"
+
+#include <algorithm>
 
 #include "RunResources.h"
-#include "DefineVideoStreamTag.h"
 #include "VideoFrameTag.h"
 #include "VideoDecoder.h"
 #include "SWFStream.h" // for read()
@@ -26,8 +28,6 @@
 #include "utility.h"
 #include "smart_ptr.h"
 
-#include <algorithm>
-
 namespace gnash {
 namespace SWF {
 

http://git.savannah.gnu.org/cgit//commit/?id=1db16ebb101a2979bf91b92f6efe2ed5f61dd59d


commit 1db16ebb101a2979bf91b92f6efe2ed5f61dd59d
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 12:53:51 2010 +0100

    Drop foreachFirst().

diff --git a/libbase/GnashAlgorithm.h b/libbase/GnashAlgorithm.h
index 7ae28b2..7b11c8b 100644
--- a/libbase/GnashAlgorithm.h
+++ b/libbase/GnashAlgorithm.h
@@ -137,22 +137,6 @@ foreachSecond(T begin, T end, U op)
     std::for_each(begin, end, boost::bind(op, boost::bind(S(), _1)));
 }
 
-/// Call a functor on the first element of each element in a range.
-//
-/// @tparam T           An iterator type satisfying the requirements of a
-///                     forward iterator
-/// @tparam U           The type of the functor op.
-/// @param begin        The start of the range to call op on.
-/// @param end          The end of the range to call op on.
-/// @param op           The function to call on each second element.
-template<typename T, typename U>
-void
-foreachFirst(T begin, T end, U op)
-{
-    typedef FirstElement<typename std::iterator_traits<T>::value_type> S;
-    std::for_each(begin, end, boost::bind(op, boost::bind(S(), _1)));
-}
-
 /// Safely call delete on each element in a range.
 //
 /// This checks that the type is fully known, but cannot check whether the

http://git.savannah.gnu.org/cgit//commit/?id=402d6167cdfc1af9fa14f64e42b9c8ded8fb6bb1


commit 402d6167cdfc1af9fa14f64e42b9c8ded8fb6bb1
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 12:52:27 2010 +0100

    Drop unused function; use ptr_containers instead of this.

diff --git a/libbase/GnashAlgorithm.h b/libbase/GnashAlgorithm.h
index f3002a4..7ae28b2 100644
--- a/libbase/GnashAlgorithm.h
+++ b/libbase/GnashAlgorithm.h
@@ -169,23 +169,6 @@ deleteChecked(T begin, T end)
     std::for_each(begin, end, CheckedDeleter<value_type>());
 }
 
-/// Safely call delete on each second element in a range of pairs.
-//
-/// This checks that the type is fully known, but cannot check whether the
-/// pointer was allocated with new. Pointers allocated with new[] or any other
-/// allocation function should never be passed to this function.
-//
-/// @param begin        The start of the range to call delete on.
-/// @param end          The end of the range to call delete on.
-template<typename T>
-void
-deleteSecondElements(T begin, T end)
-{
-    typedef SecondElement<typename std::iterator_traits<T>::value_type> S;
-    foreachSecond(begin, end, CheckedDeleter<typename S::result_type>());
-}
-
-            
 } // namespace gnash
 
 #endif

http://git.savannah.gnu.org/cgit//commit/?id=1f1132e53161ce5ba5229f4b3831bed6eb6ce985


commit 1f1132e53161ce5ba5229f4b3831bed6eb6ce985
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 12:51:58 2010 +0100

    Drop RemovePointer; use boost's version if needed again.

diff --git a/libbase/GnashAlgorithm.h b/libbase/GnashAlgorithm.h
index 8d01149..f3002a4 100644
--- a/libbase/GnashAlgorithm.h
+++ b/libbase/GnashAlgorithm.h
@@ -60,31 +60,6 @@ struct CreatePointer
     }
 };
 
-/// Recurse to the base type of a pointer.
-template<typename T>
-struct RemovePointer
-{
-    typedef T value_type;
-};
-
-template<typename T>
-struct RemovePointer<T*>
-{
-    typedef typename RemovePointer<T>::value_type value_type;
-};
-
-template<typename T>
-struct RemovePointer<boost::intrusive_ptr<T> >
-{
-    typedef typename RemovePointer<T>::value_type value_type;
-};
-
-template<typename T>
-struct RemovePointer<boost::shared_ptr<T> >
-{
-    typedef typename RemovePointer<T>::value_type value_type;
-};
-
 /// Erase elements from an associative container based on a predicate
 //
 /// This removes elements from a container such as a map if they fulfil a

http://git.savannah.gnu.org/cgit//commit/?id=7e375826ae20434868c12a6600c87df51d207836


commit 7e375826ae20434868c12a6600c87df51d207836
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 11:26:12 2010 +0100

    Use ObjectURI to index textfields.

diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 85c7e0e..5c240d1 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -84,7 +84,12 @@ namespace gnash {
 //
 //#define DEBUG_MOUSE_ENTITY_FINDING 1
 
-// Anonymous namespace for module-private definitions
+namespace {
+    MovieClip::TextFields* textfieldVar(MovieClip::TextFieldIndex* t,
+            const ObjectURI& name);
+}
+
+// Utility functors.
 namespace {
 
 /// ConstructEvent, used for queuing construction
@@ -537,12 +542,8 @@ MovieClip::getDisplayObjectAtDepth(int depth)
 bool
 MovieClip::getTextFieldVariables(const ObjectURI& uri, as_value& val)
 {
-    const string_table::key name_key = getName(uri);
-
-    const std::string& name = getStringTable(*getObject(this)).value(name_key);
-
     // Try textfield variables
-    TextFields* etc = get_textfield_variable(name);
+    TextFields* etc = textfieldVar(_text_variables.get(), uri);
     if (etc) {
         for (TextFields::const_iterator i=etc->begin(), e=etc->end();
                 i!=e; ++i) {
@@ -811,19 +812,8 @@ MovieClip::pathElement(const ObjectURI& uri)
 bool
 MovieClip::setTextFieldVariables(const ObjectURI& uri, const as_value& val)
 {
-
-    const string_table::key name = getName(uri);
-
     // Try textfield variables
-    //
-    // FIXME: Turn textfield variables into Getter/Setters (Properties)
-    //           so that as_object::set_member will do this automatically.
-    //           The problem is that setting a TextVariable named after
-    //           a builtin property will prevent *any* setting for the
-    //           property (ie: have a textfield use _x as variable name and
-    //           be scared)
-    TextFields* etc = get_textfield_variable(
-            getStringTable(*getObject(this)).value(name));
+    TextFields* etc = textfieldVar(_text_variables.get(), uri);
 
     if (!etc) return false;
 
@@ -1559,7 +1549,7 @@ MovieClip::cleanup_textfield_variables()
 
 
 void
-MovieClip::set_textfield_variable(const std::string& name, TextField* ch)
+MovieClip::set_textfield_variable(const ObjectURI& name, TextField* ch)
 {
     assert(ch);
 
@@ -1571,19 +1561,6 @@ MovieClip::set_textfield_variable(const std::string& 
name, TextField* ch)
     (*_text_variables)[name].push_back(ch);
 }
 
-MovieClip::TextFields*
-MovieClip::get_textfield_variable(const std::string& name)
-{
-    // nothing allocated yet...
-    if (!_text_variables.get()) return 0;
-
-    // TODO: should variable name be considered case-insensitive ?
-    TextFieldIndex::iterator it = _text_variables->find(name);
-    if (it == _text_variables->end()) return 0;
-    return &(it->second);
-} 
-
-
 DisplayObject*
 MovieClip::getDisplayListObject(const ObjectURI& uri)
 {
@@ -2079,4 +2056,19 @@ MovieClip::setPlayState(PlayState s)
     _playState = s;
 }
 
+namespace {
+
+MovieClip::TextFields*
+textfieldVar(MovieClip::TextFieldIndex* t, const ObjectURI& name)
+{
+    // nothing allocated yet...
+    if (!t) return 0;
+
+    // TODO: should variable name be considered case-insensitive ?
+    MovieClip::TextFieldIndex::iterator it = t->find(name);
+    if (it == t->end()) return 0;
+    return &(it->second);
+} 
+
+} // unnamed namespace
 } // namespace gnash
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 8682fe3..466a80e 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -84,9 +84,14 @@ namespace gnash {
 /// dependent on the _swf. Exports are also sought in this Movie.
 class MovieClip : public DisplayObjectContainer 
 {
-
 public:
 
+    typedef std::vector<TextField*> TextFields;
+
+    /// A container for textfields, indexed by their variable name
+    typedef std::map<ObjectURI, TextFields, ObjectURI::LessThan>
+        TextFieldIndex;
+
     typedef std::map<std::string, std::string> MovieVariables;
 
     typedef std::list<const action_buffer*> ActionList;
@@ -218,13 +223,11 @@ public:
     const DisplayObject* findDropTarget(boost::int32_t x, boost::int32_t y,
             DisplayObject* dragging) const;
 
-    void setDropTarget(const std::string& tgt)
-    {
+    void setDropTarget(const std::string& tgt) {
         _droptarget = tgt;
     }
 
-    const std::string& getDropTarget() const
-    {
+    const std::string& getDropTarget() const {
         return _droptarget;
     }
     
@@ -503,7 +506,7 @@ public:
     //
     /// A TextField variable is a variable that acts
     /// as a setter/getter for a TextField 'text' member.
-    void set_textfield_variable(const std::string& name, TextField* ch);
+    void set_textfield_variable(const ObjectURI& name, TextField* ch);
 
     void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
     
@@ -625,11 +628,6 @@ protected:
 
 private:
 
-    typedef std::vector<TextField*> TextFields;
-
-    /// A container for textfields, indexed by their variable name
-    typedef std::map<std::string, TextFields> TextFieldIndex;
-
     /// Process any completed loadVariables request
     void processCompletedLoadVariableRequests();
 
@@ -717,22 +715,6 @@ private:
 
     /// Increment _currentFrame, and take care of looping.
     void increment_frame_and_check_for_loop();
-    
-    /// \brief
-    /// Returns a vector of TextField associated with the given variable name,
-    /// or NULL if no such variable name is known.
-    //
-    /// A TextField variable is a variable that acts
-    /// as a setter/getter for a TextField 'text' member.
-    ///
-    /// Search is case-sensitive.
-    ///
-    /// @todo find out wheter we should be case sensitive or not
-    ///
-    /// @return a pointer inside a vector, will be invalidated by modifications
-    ///         of the vector (set_textfield_variable)
-    ///
-    TextFields* get_textfield_variable(const std::string& name);
 
     /// Unregister textfield variables bound to unloaded TextFields
     void cleanup_textfield_variables();
diff --git a/libcore/TextField.cpp b/libcore/TextField.cpp
index ee40aa8..17c8546 100644
--- a/libcore/TextField.cpp
+++ b/libcore/TextField.cpp
@@ -2046,48 +2046,26 @@ TextField::registerTextVariable()
     const ObjectURI& key = varRef.second;
     as_object* obj = getObject(this);
     const int version = getSWFVersion(*obj);
-    string_table& st = getStringTable(*obj);
     
     // check if the VariableName already has a value,
     // in that case update text value
     as_value val;
     if (target->get_member(key, &val) ) {
-#ifdef DEBUG_DYNTEXT_VARIABLES
-        log_debug(_("target object (%s @ %p) does have a member named %s"),
-            typeName(*target), (void*)target, st.value(key));
-#endif
         // TODO: pass environment to to_string ?
         // as_environment& env = get_environment();
         setTextValue(utf8::decodeCanonicalString(val.to_string(), version));
     }
     else if (_textDefined) {
         as_value newVal = as_value(utf8::encodeCanonicalString(_text, 
version));
-#ifdef DEBUG_DYNTEXT_VARIABLES
-        log_debug(_("target sprite (%s @ %p) does NOT have a member "
-                    "named %s (no problem, we'll add it with value %s)"),
-                    typeName(*target), (void*)target,
-                    st.value(key), newVal);
-#endif
         target->set_member(key, newVal);
     }
-    else {
-#ifdef DEBUG_DYNTEXT_VARIABLES
-        log_debug(_("target sprite (%s @ %p) does NOT have a member "
-                    "named %s, and we don't have text defined"),
-                    typeName(*target), (void*)target, st.value(key));
-#endif
-    }
 
     MovieClip* sprite = get<MovieClip>(target);
 
     if (sprite) {
         // add the textfield variable to the target sprite
         // TODO: have set_textfield_variable take a string_table::key instead ?
-#ifdef DEBUG_DYNTEXT_VARIABLES
-        log_debug("Calling set_textfield_variable(%s) against sprite %s",
-                st.value(key), sprite->getTarget());
-#endif
-        sprite->set_textfield_variable(key.toString(st), this);
+        sprite->set_textfield_variable(key, this);
 
     }
     _text_variable_registered=true;

http://git.savannah.gnu.org/cgit//commit/?id=f92ab79a3a3709977f3915b348569fa5e53727fb


commit f92ab79a3a3709977f3915b348569fa5e53727fb
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 10:57:30 2010 +0100

    Fix testsuite.

diff --git a/testsuite/MovieTester.cpp b/testsuite/MovieTester.cpp
index c05f029..55ed1ea 100644
--- a/testsuite/MovieTester.cpp
+++ b/testsuite/MovieTester.cpp
@@ -633,13 +633,13 @@ namespace {
 /// The function returns false when at least one pixel of the block was
 /// outside the main frame buffer. In that case the value in color_return
 /// is undefined.
-bool getAveragePixel(const Renderer& r, rgba& color_return, int x, int y, 
+bool getAveragePixel(const Renderer& rh, rgba& color_return, int x, int y, 
     unsigned int radius) 
 {
     assert(radius>0); 
 
     // optimization:
-    if (radius==1) return getPixel(color_return, x, y);
+    if (radius==1) return rh.getPixel(color_return, x, y);
 
     unsigned int r=0, g=0, b=0, a=0;
     
@@ -653,7 +653,7 @@ bool getAveragePixel(const Renderer& r, rgba& color_return, 
int x, int y,
     
     for (int yp=y; yp<ye; yp++)
     for (int xp=x; xp<xe; xp++) {
-        if (!getPixel(pixel, xp, yp))
+        if (!rh.getPixel(pixel, xp, yp))
             return false;
             
         r += pixel.m_r;            

http://git.savannah.gnu.org/cgit//commit/?id=11a59ae46ed3b57f771dcc8ae1ed6c910a813aad


commit 11a59ae46ed3b57f771dcc8ae1ed6c910a813aad
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 10:48:43 2010 +0100

    Make another function non-virtual

diff --git a/librender/Renderer.h b/librender/Renderer.h
index b5f3e82..42e97f7 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -406,7 +406,7 @@ public:
     /// Converts pixel coordinates to world coordinates (TWIPS)
     virtual point pixel_to_world(int x, int y) const = 0;
     
-    virtual geometry::Range2d<int> pixel_to_world(
+    geometry::Range2d<int> pixel_to_world(
                     const geometry::Range2d<int>& pixelbounds) const
     {
         point topleft = pixel_to_world(

http://git.savannah.gnu.org/cgit//commit/?id=74a9d995b54fc6541d87d753d8266f1cf1ef6988


commit 74a9d995b54fc6541d87d753d8266f1cf1ef6988
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 10:46:57 2010 +0100

    Reduce the number of overloaded virtual functions with default
    implementations.

diff --git a/librender/Renderer.h b/librender/Renderer.h
index 97c9a1e..b5f3e82 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -392,13 +392,22 @@ public:
     /// ==================================================================
     
     /// Converts world coordinates to pixel coordinates
-    virtual geometry::Range2d<int> world_to_pixel(const SWFRect& worldbounds) 
= 0;
+    virtual geometry::Range2d<int> world_to_pixel(const SWFRect& worldbounds)
+        const = 0;
     
+    geometry::Range2d<int> world_to_pixel(const geometry::Range2d<int>& wb)
+        const
+    {
+        if ((wb.isNull() || wb.isWorld())) return wb;
+        return world_to_pixel(SWFRect(wb.getMinX(), wb.getMinY(),
+                       wb.getMaxX(), wb.getMaxY()));
+    }
+        
     /// Converts pixel coordinates to world coordinates (TWIPS)
-    virtual point pixel_to_world(int x, int y) = 0;
+    virtual point pixel_to_world(int x, int y) const = 0;
     
     virtual geometry::Range2d<int> pixel_to_world(
-                    const geometry::Range2d<int>& pixelbounds)
+                    const geometry::Range2d<int>& pixelbounds) const
     {
         point topleft = pixel_to_world(
                         pixelbounds.getMinX(), pixelbounds.getMinY());
@@ -408,22 +417,7 @@ public:
         return geometry::Range2d<int> (topleft.x, topleft.y, 
             bottomright.x, bottomright.y);
     }
-    
-    virtual geometry::Range2d<int> world_to_pixel(
-                    const geometry::Range2d<int>& worldbounds)
-    {
-        if ((worldbounds.isNull() || worldbounds.isWorld())) return 
worldbounds;
-
-       // We always get compiler warnings on casting floats to int
-       // here, so we cast it ourselves to get rid of the warning
-       // message. Note that in both cases this rounds the float to
-       // an integer by dropping the decimal part.
-        return world_to_pixel(SWFRect(static_cast<int>(worldbounds.getMinX()),
-                                  static_cast<int>(worldbounds.getMinY()),
-                                  static_cast<int>(worldbounds.getMaxX()),
-                                  static_cast<int>(worldbounds.getMaxY())));
-    }
-        
+
     /// \brief
     /// Checks if the given bounds are (partially) in the current drawing
     /// clipping area.
diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index 8f6fd21..4d337d6 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -1922,7 +1922,7 @@ public:
   }                      
   
   inline void world_to_pixel(int& x, int& y,
-    float world_x, float world_y)
+    float world_x, float world_y) const
   {
     // negative pixels seems ok here... we don't 
     // clip to valid range, use world_to_pixel(SWFRect&)
@@ -1933,7 +1933,7 @@ public:
     y = (int)p.y;
   }
 
-  geometry::Range2d<int> world_to_pixel(const SWFRect& wb)
+  geometry::Range2d<int> world_to_pixel(const SWFRect& wb) const
   {
       using namespace gnash::geometry;
 
@@ -1948,20 +1948,8 @@ public:
     return Range2d<int>(xmin, ymin, xmax, ymax);
   }
   
-  geometry::Range2d<int> world_to_pixel(const geometry::Range2d<int>& wb)
-  {
-    if (wb.isNull() || wb.isWorld()) return wb;
-    
-    int xmin, ymin, xmax, ymax;
-
-    world_to_pixel(xmin, ymin, wb.getMinX(), wb.getMinY());
-    world_to_pixel(xmax, ymax, wb.getMaxX(), wb.getMaxY());
-
-    return geometry::Range2d<int>(xmin, ymin, xmax, ymax);
-  }
-  
   point 
-  pixel_to_world(int x, int y)
+  pixel_to_world(int x, int y) const
   {
     point p(x, y);
     SWFMatrix mat = stage_matrix;
@@ -1992,7 +1980,7 @@ public:
     
       const Range2d<int>& range = ranges.getRange(rno);
 
-      Range2d<int> pixbounds = world_to_pixel(range);
+      Range2d<int> pixbounds = Renderer::world_to_pixel(range);
       
       geometry::Range2d<int> bounds = Intersection(pixbounds, visiblerect);
       
@@ -2014,7 +2002,7 @@ public:
 
     using gnash::geometry::Range2d;
   
-    Range2d<int> pixbounds = world_to_pixel(bounds);
+    Range2d<int> pixbounds = Renderer::world_to_pixel(bounds);
     
     for (unsigned int cno=0; cno<_clipbounds.size(); ++cno) {  
       if (Intersect(pixbounds, _clipbounds[cno]))
diff --git a/librender/cairo/Renderer_cairo.cpp 
b/librender/cairo/Renderer_cairo.cpp
index 7bf4d31..deec02d 100644
--- a/librender/cairo/Renderer_cairo.cpp
+++ b/librender/cairo/Renderer_cairo.cpp
@@ -558,7 +558,7 @@ Renderer_cairo::drawVideoFrame(image::GnashImage* 
baseframe, const Transform& xf
 
   
 geometry::Range2d<int>
-Renderer_cairo::world_to_pixel(const SWFRect& worldbounds)
+Renderer_cairo::world_to_pixel(const SWFRect& worldbounds) const
 {
     double xmin = worldbounds.get_x_min(),
            ymin = worldbounds.get_y_min(),
@@ -574,7 +574,7 @@ Renderer_cairo::world_to_pixel(const SWFRect& worldbounds)
 
 // FIXME
 point
-Renderer_cairo::pixel_to_world(int x, int y)
+Renderer_cairo::pixel_to_world(int x, int y) const
 {
     cairo_matrix_t inv_stage = _stage_mat;
     cairo_matrix_invert(&inv_stage);
diff --git a/librender/cairo/Renderer_cairo.h b/librender/cairo/Renderer_cairo.h
index 0a1a2eb..a70c7d9 100644
--- a/librender/cairo/Renderer_cairo.h
+++ b/librender/cairo/Renderer_cairo.h
@@ -50,8 +50,10 @@ public:
     void drawVideoFrame(image::GnashImage* baseframe, const Transform& xform,
                                 const SWFRect* bounds, bool smooth);
 
-    geometry::Range2d<int> world_to_pixel(const SWFRect& worldbounds);
-    point pixel_to_world(int x, int y);
+    virtual geometry::Range2d<int> world_to_pixel(const SWFRect& worldbounds)
+        const;
+
+    virtual point pixel_to_world(int x, int y) const;
 
     void set_color(const rgba& c);
 
diff --git a/librender/opengl/Renderer_ogl.cpp 
b/librender/opengl/Renderer_ogl.cpp
index 7f4fdac..f2ccaa9 100644
--- a/librender/opengl/Renderer_ogl.cpp
+++ b/librender/opengl/Renderer_ogl.cpp
@@ -963,7 +963,7 @@ private:
 
   // FIXME
   geometry::Range2d<int>
-  world_to_pixel(const SWFRect& worldbounds)
+  world_to_pixel(const SWFRect& worldbounds) const
   {
     // TODO: verify this is correct
     geometry::Range2d<int> ret(worldbounds.getRange());
@@ -973,7 +973,7 @@ private:
 
   // FIXME
   point 
-  pixel_to_world(int x, int y)
+  pixel_to_world(int x, int y) const
   {
     // TODO: verify this is correct
     return point(pixelsToTwips(x), pixelsToTwips(y));

http://git.savannah.gnu.org/cgit//commit/?id=0cd106083f779a0366d6587e2478ef51f5d65c6c


commit 0cd106083f779a0366d6587e2478ef51f5d65c6c
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 10:23:30 2010 +0100

    Drop unused functions and const-correct used ones.

diff --git a/librender/Renderer.h b/librender/Renderer.h
index a10d937..97c9a1e 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -434,31 +434,9 @@ public:
     /// By default this method always returns true, which will ensure correct
     /// rendering. If possible, it should be re-implemented by the renderer 
     /// handler for better performance.
-    /// 'bounds' contains TWIPS coordinates.
-    ///
-    /// TODO: Take a Range2d<T> rather then a gnash::SWFRect ?
-    ///             Would T==int be good ? TWIPS as integer types ?
-    ///
-    /// See also gnash::renderer::bounds_in_clipping_area
-    ///
-    virtual bool bounds_in_clipping_area(const SWFRect& bounds) {
-        return bounds_in_clipping_area(bounds.getRange());
-    }
-    
-    virtual bool bounds_in_clipping_area(const InvalidatedRanges& ranges)
-    {
-        for (unsigned int rno=0; rno<ranges.size(); rno++) 
-        {
-            if (bounds_in_clipping_area(ranges.getRange(rno)))
-                return true;
-        }
-                
-        return false;
-    }
-    
-    virtual bool bounds_in_clipping_area(
-            const geometry::Range2d<int>& /*bounds*/)
-    {
+    /// b contains TWIPS coordinates.
+    virtual bool bounds_in_clipping_area(const geometry::Range2d<int>& /*b*/)
+        const {
         return true;
     }
 
@@ -545,7 +523,6 @@ public:
     class Internal 
     {
     public:
-
         /// Prepare the renderer for internal rendering
         Internal(Renderer& r, image::GnashImage& im)
             :
diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index fe22b39..8f6fd21 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -1118,7 +1118,7 @@ public:
 
         cur_bounds.expand_to_transformed_rect(xform.matrix, shape.getBounds());
                 
-        if (!Renderer::bounds_in_clipping_area(cur_bounds))
+        if (!bounds_in_clipping_area(cur_bounds.getRange()))
         {
             return; // no need to draw
         }        
@@ -2009,8 +2009,9 @@ public:
   }
   
   
-  virtual bool bounds_in_clipping_area(const geometry::Range2d<int>& bounds) { 
   
-    
+  virtual bool bounds_in_clipping_area(const geometry::Range2d<int>& bounds)
+    const {
+
     using gnash::geometry::Range2d;
   
     Range2d<int> pixbounds = world_to_pixel(bounds);

http://git.savannah.gnu.org/cgit//commit/?id=450d11590212b474b4439bc7abf279faa4c339a7


commit 450d11590212b474b4439bc7abf279faa4c339a7
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Dec 12 10:09:40 2010 +0100

    Remove test-only function from renderer interface.

diff --git a/librender/Renderer.h b/librender/Renderer.h
index 3ca7f53..a10d937 100644
--- a/librender/Renderer.h
+++ b/librender/Renderer.h
@@ -482,58 +482,6 @@ public:
         return false; // avoid compiler warning        
     }
     
-    
-    /// Returns the average RGB color for a square block on the stage. The 
-    /// width and height of the block is defined by "radius" and x/y refer
-    /// to the center of the block. radius==1 equals getPixel() and radius==0
-    /// is illegal. For even "radius" values, the center point is not exactly
-    /// defined. 
-    /// The function returns false when at least one pixel of the block was
-    /// outside the main frame buffer. In that case the value in color_return
-    /// is undefined.
-    /// This implementation is provided for simplicity. Renderers should
-    /// implement a specialized version for better performance.
-    virtual bool getAveragePixel(rgba& color_return, int x, int y, 
-        unsigned int radius) const
-    {
-    
-        assert(radius>0); 
-    
-        // optimization:
-        if (radius==1) return getPixel(color_return, x, y);
-    
-        unsigned int r=0, g=0, b=0, a=0;
-        
-        x -= radius/2;
-        y -= radius/2;
-        
-        int xe = x+radius;
-        int ye = y+radius;
-
-        rgba pixel;
-        
-        for (int yp=y; yp<ye; yp++)
-        for (int xp=x; xp<xe; xp++)
-        {
-            if (!getPixel(pixel, xp, yp))
-                return false;
-                
-            r += pixel.m_r;            
-            g += pixel.m_g;            
-            b += pixel.m_b;            
-            a += pixel.m_a;            
-        }
-        
-        int pcount = radius*radius; 
-        color_return.m_r = r / pcount; 
-        color_return.m_g = g / pcount; 
-        color_return.m_b = b / pcount; 
-        color_return.m_a = a / pcount; 
-        
-        return true;
-    }
-    
-    
     /// \brief
     /// Initializes the renderer for off-screen rendering used by the    
     /// testsuite.
diff --git a/testsuite/MovieTester.cpp b/testsuite/MovieTester.cpp
index 1f24b82..c05f029 100644
--- a/testsuite/MovieTester.cpp
+++ b/testsuite/MovieTester.cpp
@@ -70,6 +70,11 @@ using std::endl;
 
 namespace gnash {
 
+namespace {
+    bool getAveragePixel(const Renderer& r, rgba& color_return, int x, int y, 
+        unsigned int radius);
+}
+
 MovieTester::MovieTester(const std::string& url)
     :
     _forceRedraw(true),
@@ -372,7 +377,7 @@ MovieTester::checkPixel(int x, int y, unsigned radius, 
const rgba& color,
        
        const Renderer& handler = *rend.getRenderer();
        
-       if ( ! handler.getAveragePixel(obt_col, x, y, radius) ) {
+       if (!getAveragePixel(handler, obt_col, x, y, radius) ) {
            ss << " is out of rendering buffer";
            cout << X << "FAILED: " << ss.str() << " (" << label << ")" << endl;
            continue;
@@ -618,4 +623,54 @@ MovieTester::restart()
     render();
 }
 
+namespace {
+    
+/// Returns the average RGB color for a square block on the stage. The 
+/// width and height of the block is defined by "radius" and x/y refer
+/// to the center of the block. radius==1 equals getPixel() and radius==0
+/// is illegal. For even "radius" values, the center point is not exactly
+/// defined. 
+/// The function returns false when at least one pixel of the block was
+/// outside the main frame buffer. In that case the value in color_return
+/// is undefined.
+bool getAveragePixel(const Renderer& r, rgba& color_return, int x, int y, 
+    unsigned int radius) 
+{
+    assert(radius>0); 
+
+    // optimization:
+    if (radius==1) return getPixel(color_return, x, y);
+
+    unsigned int r=0, g=0, b=0, a=0;
+    
+    x -= radius/2;
+    y -= radius/2;
+    
+    int xe = x+radius;
+    int ye = y+radius;
+
+    rgba pixel;
+    
+    for (int yp=y; yp<ye; yp++)
+    for (int xp=x; xp<xe; xp++) {
+        if (!getPixel(pixel, xp, yp))
+            return false;
+            
+        r += pixel.m_r;            
+        g += pixel.m_g;            
+        b += pixel.m_b;            
+        a += pixel.m_a;            
+    }
+    
+    int pcount = radius*radius; 
+    color_return.m_r = r / pcount; 
+    color_return.m_g = g / pcount; 
+    color_return.m_b = b / pcount; 
+    color_return.m_a = a / pcount; 
+    
+    return true;
+}
+
+}
+
 } // namespace gnash

-----------------------------------------------------------------------

Summary of changes:
 libbase/GnashAlgorithm.h             |   58 -----------------
 libcore/DisplayList.cpp              |    2 +-
 libcore/DisplayList.h                |    8 +--
 libcore/DisplayObject.h              |    6 +-
 libcore/MovieClip.cpp                |   61 ++++++++----------
 libcore/MovieClip.h                  |   36 +++--------
 libcore/TextField.cpp                |   24 +-------
 libcore/Video.cpp                    |   61 +++++++------------
 libcore/Video.h                      |    6 +-
 libcore/swf/DefineVideoStreamTag.cpp |   64 +++----------------
 libcore/swf/DefineVideoStreamTag.h   |   78 ++++++++++++++---------
 libcore/swf/PlaceObject2Tag.h        |    4 +-
 libcore/swf/VideoFrameTag.cpp        |    6 +-
 librender/Renderer.h                 |  115 +++++-----------------------------
 librender/agg/Renderer_agg.cpp       |   29 +++------
 librender/cairo/Renderer_cairo.cpp   |    4 +-
 librender/cairo/Renderer_cairo.h     |    6 +-
 librender/opengl/Renderer_ogl.cpp    |    4 +-
 testsuite/MovieTester.cpp            |   57 ++++++++++++++++-
 19 files changed, 217 insertions(+), 412 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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