gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10787: Clean up DefinitionTag inter


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10787: Clean up DefinitionTag interface.
Date: Tue, 14 Apr 2009 10:36:39 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10787
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-04-14 10:36:39 +0200
message:
  Clean up DefinitionTag interface.
modified:
  libcore/Shape.cpp
  libcore/Shape.h
  libcore/StaticText.h
  libcore/TextField.cpp
  libcore/Video.cpp
  libcore/parser/BitmapMovieDefinition.h
  libcore/parser/SWFMovieDefinition.h
  libcore/parser/sprite_definition.h
  libcore/swf/DefineButtonTag.h
  libcore/swf/DefineEditTextTag.h
  libcore/swf/DefineMorphShapeTag.h
  libcore/swf/DefineShapeTag.h
  libcore/swf/DefineTextTag.h
  libcore/swf/DefineVideoStreamTag.h
  libcore/swf/DefinitionTag.h
  testsuite/DummyMovieDefinition.h
    ------------------------------------------------------------
    revno: 10786.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-04-14 09:00:59 +0200
    message:
      Drop get_bound from DefinitionTag, as it is nonsense for many subclasses.
      
      Drop all non-const methods from DefineEditTextTag. Drop get_bound
      implementations from sprite_instance, SWFMovieDefinition, 
DefineMorphShapeTag,
      and DefineButtonTag.
    modified:
      libcore/parser/SWFMovieDefinition.h
      libcore/parser/sprite_definition.h
      libcore/swf/DefineButtonTag.h
      libcore/swf/DefineEditTextTag.h
      libcore/swf/DefineMorphShapeTag.h
      libcore/swf/DefinitionTag.h
    ------------------------------------------------------------
    revno: 10786.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-04-14 09:23:05 +0200
    message:
      Drop get_bound from BitmapMovieDefinition.
    modified:
      libcore/parser/BitmapMovieDefinition.h
      libcore/swf/DefineShapeTag.h
      libcore/swf/DefineTextTag.h
    ------------------------------------------------------------
    revno: 10786.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-04-14 09:24:33 +0200
    message:
      Drop get_bound from DummyMovieDefinition.
    modified:
      testsuite/DummyMovieDefinition.h
    ------------------------------------------------------------
    revno: 10786.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-04-14 09:33:24 +0200
    message:
      Rename get_bound() to bounds().
    modified:
      libcore/Shape.cpp
      libcore/Shape.h
      libcore/StaticText.h
      libcore/TextField.cpp
      libcore/Video.cpp
      libcore/swf/DefineEditTextTag.h
      libcore/swf/DefineShapeTag.h
      libcore/swf/DefineTextTag.h
      libcore/swf/DefineVideoStreamTag.h
=== modified file 'libcore/Shape.cpp'
--- a/libcore/Shape.cpp 2009-04-08 07:08:06 +0000
+++ b/libcore/Shape.cpp 2009-04-14 07:33:24 +0000
@@ -41,7 +41,7 @@
     //       the collision detection find you inside a self-crossing
     //       shape).
     if (_def) {
-        if (!_def->get_bound().point_test(lp.x, lp.y)) return false;
+        if (!_def->bounds().point_test(lp.x, lp.y)) return false;
         return _def->pointTestLocal(lp.x, lp.y, wm);
     }
     assert(_shape.get());

=== modified file 'libcore/Shape.h'
--- a/libcore/Shape.h   2009-04-09 12:45:20 +0000
+++ b/libcore/Shape.h   2009-04-14 07:33:24 +0000
@@ -58,7 +58,7 @@
        virtual void display();
 
     virtual rect getBounds() const {
-        return _def ? _def->get_bound() : _shape->getBounds();
+        return _def ? _def->bounds() : _shape->getBounds();
     }
     
     virtual bool pointInShape(boost::int32_t  x, boost::int32_t  y) const;

=== modified file 'libcore/StaticText.h'
--- a/libcore/StaticText.h      2009-04-09 12:45:20 +0000
+++ b/libcore/StaticText.h      2009-04-14 07:33:24 +0000
@@ -87,7 +87,7 @@
     void setSelectionColor(boost::uint32_t color);
 
     virtual rect getBounds() const {
-        return _def->get_bound();
+        return _def->bounds();
     }
 
     virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const;

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-04-09 12:45:20 +0000
+++ b/libcore/TextField.cpp     2009-04-14 07:33:24 +0000
@@ -145,7 +145,7 @@
     _selectable(!def.noSelect()),
     _autoSize(autoSizeNone),
     _type(def.readOnly() ? typeDynamic : typeInput),
-    _bounds(def.get_bound()),
+    _bounds(def.bounds()),
     _selection(0, 0)
 {
 

=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2009-04-08 13:00:17 +0000
+++ b/libcore/Video.cpp 2009-04-14 07:33:24 +0000
@@ -140,7 +140,7 @@
        assert(m_def);
 
        SWFMatrix m = getWorldMatrix();
-       const rect& bounds = m_def->get_bound();
+       const rect& bounds = m_def->bounds();
 
        GnashImage* img = getVideoFrame();
        if (img)
@@ -275,14 +275,14 @@
     
        ranges.add(m_old_invalidated_ranges);
        
-       // NOTE: do not use m_def->get_bounds()
+       // NOTE: do not use m_def->boundss()
 
        // if m_def is NULL we've been constructed by 'new Video', in this
        // case I think add_invalidated_bouns would never be invoked on us...
        assert ( m_def );
 
        rect bounds;    
-       bounds.expand_to_transformed_rect(getWorldMatrix(), m_def->get_bound());
+       bounds.expand_to_transformed_rect(getWorldMatrix(), m_def->bounds());
        
        ranges.add(bounds.getRange());            
 }
@@ -314,7 +314,7 @@
 rect
 Video::getBounds() const
 {
-       if (_embeddedStream) return m_def->get_bound();
+       if (_embeddedStream) return m_def->bounds();
 
        // TODO: return the bounds of the dynamically
        //       loaded video if not embedded ?

=== modified file 'libcore/parser/BitmapMovieDefinition.h'
--- a/libcore/parser/BitmapMovieDefinition.h    2009-04-07 09:19:54 +0000
+++ b/libcore/parser/BitmapMovieDefinition.h    2009-04-14 07:23:05 +0000
@@ -84,10 +84,6 @@
                return _framesize;
        }
 
-       virtual const rect& get_bound() const {
-               return _framesize;
-       }
-
        /// Return number of bytes loaded
        //
        /// Since no progressive load is implemented yet

=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h       2009-04-09 12:45:20 +0000
+++ b/libcore/parser/SWFMovieDefinition.h       2009-04-14 07:00:59 +0000
@@ -387,17 +387,6 @@
 
        virtual const std::string& get_url() const { return _url; }
        
-       const rect&     get_bound() const {
-    // It is required that get_bound() is implemented in DisplayObject 
definition
-    // classes. However, it makes no sense to call it for movie interfaces.
-    // get_bound() is currently only used by DisplayObject which normally
-    // is used only shape DisplayObject definitions. See DefinitionTag.h to 
learn
-    // why it is virtual anyway.
-    abort(); // should not be called  
-               static rect unused;
-               return unused;
-       }
-
 #ifdef USE_SWFTREE
 
        // These methods attach the contents of the METADATA tag

=== modified file 'libcore/parser/sprite_definition.h'
--- a/libcore/parser/sprite_definition.h        2009-04-09 08:59:49 +0000
+++ b/libcore/parser/sprite_definition.h        2009-04-14 07:00:59 +0000
@@ -322,17 +322,6 @@
                return true;
        }
 
-       const rect&     get_bound() const {
-    // It is required that get_bound() is implemented in DisplayObject 
definition
-    // classes. However, it makes no sense to call it for sprite definitions.
-    // get_bound() is currently only used by DisplayObject which normally
-    // is used only shape DisplayObject definitions. See SWF::DefinitionTag.h 
to learn
-    // why it is virtual anyway.
-    abort(); // should not be called
-               static rect unused;
-               return unused;
-  }
-
        /// \brief
        /// The constructor to use for setting up the interface
        /// for new instances of this sprite

=== modified file 'libcore/swf/DefineButtonTag.h'
--- a/libcore/swf/DefineButtonTag.h     2009-04-07 12:34:43 +0000
+++ b/libcore/swf/DefineButtonTag.h     2009-04-14 07:00:59 +0000
@@ -23,7 +23,6 @@
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "DefinitionTag.h"
 #include "sound_definition.h"
-#include "rect.h" // for get_bound
 #include "SWFMatrix.h" // for composition
 #include "cxform.h" // for composition
 #include "action_buffer.h" // for composition of ButtonAction
@@ -195,19 +194,6 @@
        /// Create a mutable instance of our definition.
        DisplayObject* createDisplayObject(DisplayObject* parent, int id);
 
-       const rect&     get_bound() const {
-               // It is required that get_bound() is implemented in 
DisplayObject
-        // definition classes. However, button DisplayObject definitions do
-        // not have shape definitions themselves. Instead, they hold a list
-        // of DefineShapeTag. get_bound() is currently only used
-        // by DisplayObject which normally is used only shape DisplayObject
-        // definitions. See DefinitionTag.h to learn why it is virtual anyway.
-               // get_button_bound() is used for buttons.
-               abort(); // should not be called  
-               static rect unused;
-               return unused;
-       }
-  
     /// Access the ButtonRecords directly. Used for modifying the
     /// Cxform by a DefineButtonCxform tag.
     ButtonRecords& buttonRecords() { return _buttonRecords; }

=== modified file 'libcore/swf/DefineEditTextTag.h'
--- a/libcore/swf/DefineEditTextTag.h   2009-04-07 12:34:43 +0000
+++ b/libcore/swf/DefineEditTextTag.h   2009-04-14 07:33:24 +0000
@@ -65,7 +65,7 @@
        static void loader(SWFStream& in, TagType tag, movie_definition& m,
             const RunInfo& r);
 
-    const rect& get_bound() const { return _rect; }
+    const rect& bounds() const { return _rect; }
 
     DisplayObject* createDisplayObject(DisplayObject* parent, int id);
 
@@ -92,16 +92,6 @@
                return _maxChars;
        }
 
-       /// Set boundaries of this textfield
-       //
-       /// This method is used for dynamic textfields
-       /// (actionscript created)
-       ///
-       void set_bounds(const rect& bounds)
-       {
-               _rect = bounds;
-       }
-
        /// Get right margin in twips
        boost::uint16_t rightMargin() const {
                return _rightMargin;
@@ -123,24 +113,11 @@
                return _textHeight;
        }
 
-       /// Set height of font  in twips.
-       // 
-       /// Used by dynamically created textfields.
-       ///
-       void setFontHeight(boost::uint16_t h) {
-               _textHeight = h;
-       }
-
        /// Get color of the text
        const rgba& color() const {
                return _color;
        }
 
-       /// Set color of the text
-       void setTextColor(const rgba& col) {
-               _color = col;
-       }
-
        /// \brief
        /// Get extra space between lines (in twips).
        //
@@ -184,7 +161,7 @@
 
        bool noSelect() const 
        {
-         return _noSelect;
+            return _noSelect;
        }
        
        /// Return true if HTML was allowed by definition

=== modified file 'libcore/swf/DefineMorphShapeTag.h'
--- a/libcore/swf/DefineMorphShapeTag.h 2009-04-07 12:34:43 +0000
+++ b/libcore/swf/DefineMorphShapeTag.h 2009-04-14 07:00:59 +0000
@@ -60,10 +60,6 @@
         return _shape2;
     }
 
-    virtual const rect& get_bound() const {
-        return _bounds;
-    }
-
 private:
 
     DefineMorphShapeTag(SWFStream& in, SWF::TagType tag, movie_definition& md);

=== modified file 'libcore/swf/DefineShapeTag.h'
--- a/libcore/swf/DefineShapeTag.h      2009-04-07 12:45:25 +0000
+++ b/libcore/swf/DefineShapeTag.h      2009-04-14 07:33:24 +0000
@@ -43,7 +43,7 @@
        virtual DisplayObject* createDisplayObject(DisplayObject* parent, int 
id);
        
     /// Get cached bounds of this shape.
-    const rect&        get_bound() const { return _shape.getBounds(); }
+    const rect& bounds() const { return _shape.getBounds(); }
 
     virtual bool pointTestLocal(boost::int32_t x, boost::int32_t y, 
             const SWFMatrix& wm) const;

=== modified file 'libcore/swf/DefineTextTag.h'
--- a/libcore/swf/DefineTextTag.h       2009-04-08 14:08:39 +0000
+++ b/libcore/swf/DefineTextTag.h       2009-04-14 07:33:24 +0000
@@ -52,7 +52,7 @@
        /// Draw the string.
        void display(const StaticText& inst) const;
        
-       const rect&     get_bound() const {
+       const rect& bounds() const {
         // TODO: There is a _matrix field in the definition(!) that's
         // currently ignored. Don't know if it needs to be transformed... 
         return _rect; 

=== modified file 'libcore/swf/DefineVideoStreamTag.h'
--- a/libcore/swf/DefineVideoStreamTag.h        2009-04-07 12:34:43 +0000
+++ b/libcore/swf/DefineVideoStreamTag.h        2009-04-14 07:33:24 +0000
@@ -107,7 +107,7 @@
             movie_definition& m);
 
        /// Return local video bounds in twips
-       const rect&     get_bound() const
+       const rect&     bounds() const
        {
                return m_bound;
        }

=== modified file 'libcore/swf/DefinitionTag.h'
--- a/libcore/swf/DefinitionTag.h       2009-04-07 12:45:25 +0000
+++ b/libcore/swf/DefinitionTag.h       2009-04-14 07:00:59 +0000
@@ -38,28 +38,21 @@
 namespace gnash {
 namespace SWF {
 
-/// Immutable data representing the template of a movie element.
-//
-/// This is not really a public interface.  It's here so it
-/// can be mixed into movie_definition and sprite_definition,
-/// without using multiple inheritance.
-///
+/// Immutable data representing the definition of a movie display element.
 class DefinitionTag : public ExportableResource, boost::noncopyable
 {
 public:
 
        virtual ~DefinitionTag() {};
        
-       /// Should stick the result in a boost::intrusive_ptr immediately.
+       /// Create a DisplayObject with the given parent and id
        //
-       /// default is to make a DisplayObject
-       ///
+    /// Calling this function creates a new DisplayObject from the
+    /// DefinitionTag and adds it as a child of the specified parent
+    /// DisplayObject.
        virtual DisplayObject* createDisplayObject(DisplayObject* parent,
             int id) = 0;
        
-       // Declared as virtual here because DisplayObject needs access to it
-       virtual const rect&     get_bound() const = 0;
-       
 };
 
 } // namespace SWF

=== modified file 'testsuite/DummyMovieDefinition.h'
--- a/testsuite/DummyMovieDefinition.h  2009-04-03 09:29:19 +0000
+++ b/testsuite/DummyMovieDefinition.h  2009-04-14 07:24:33 +0000
@@ -116,10 +116,6 @@
                return _framesize;
        }
 
-       virtual const rect& get_bound() const {
-               return _framesize;
-       }
-
        virtual size_t get_bytes_loaded() const {
                return 0;
        }


reply via email to

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