gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/Makefile.am server/rect....


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Makefile.am server/rect....
Date: Fri, 01 Dec 2006 16:35:39 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/12/01 16:35:39

Modified files:
        .              : ChangeLog 
        server         : Makefile.am rect.cpp rect.h 
        server/asobj   : Makefile.am 
        server/parser  : Makefile.am movie_definition.h 
                         video_stream_def.h 
        server/vm      : Makefile.am 
        testsuite      : Makefile.am 
        utilities      : Makefile.am 

Log message:
                * server/Makefile.am, server/rect.cpp, server/rect.h,
                  server/asobj/Makefile.am, server/parser/Makefile.am,
                  server/parser/movie_definition.h, 
server/parser/video_stream_def.h,
                  server/vm/Makefile.am, utilities/Makefile.am, 
testsuite/Makefile.am:
                  Rewritten gnash::rect class to use Range2d<float>.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1841&r2=1.1842
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/rect.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Makefile.am?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_definition.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/video_stream_def.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/Makefile.am?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/Makefile.am?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/Makefile.am?cvsroot=gnash&r1=1.41&r2=1.42

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1841
retrieving revision 1.1842
diff -u -b -r1.1841 -r1.1842
--- ChangeLog   1 Dec 2006 15:52:17 -0000       1.1841
+++ ChangeLog   1 Dec 2006 16:35:38 -0000       1.1842
@@ -1,5 +1,13 @@
 2006-12-01 Sandro Santilli <address@hidden>
 
+       * server/Makefile.am, server/rect.cpp, server/rect.h,
+         server/asobj/Makefile.am, server/parser/Makefile.am,
+          server/parser/movie_definition.h, server/parser/video_stream_def.h,
+         server/vm/Makefile.am, utilities/Makefile.am, testsuite/Makefile.am:
+         Rewritten gnash::rect class to use Range2d<float>.
+
+2006-12-01 Sandro Santilli <address@hidden>
+
        * backend/render_handler.h, server/render.h:
          some doxygen notes for bounds_in_clipping_area.
 

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- server/Makefile.am  28 Nov 2006 12:10:27 -0000      1.93
+++ server/Makefile.am  1 Dec 2006 16:35:38 -0000       1.94
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.93 2006/11/28 12:10:27 strk Exp $
+# $Id: Makefile.am,v 1.94 2006/12/01 16:35:38 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -36,6 +36,7 @@
        -I$(top_srcdir)/server/parser \
        -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)        \
        $(PTHREAD_CFLAGS) \
        $(DMALLOC_CFLAGS) \

Index: server/rect.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/rect.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/rect.cpp     28 Nov 2006 15:59:30 -0000      1.4
+++ server/rect.cpp     1 Dec 2006 16:35:38 -0000       1.5
@@ -23,34 +23,22 @@
 #include "matrix.h"
 #include "types.h" // for TWIPS_TO_PIXELS
 
-namespace gnash {
-
-rect::rect()
-       :
-       m_x_min(1),
-       m_x_max(-1)
-{
-}
-
-void rect::set_null()
-{
-       m_x_min = 1;
-       m_x_max = -1;
-}
+#include <sstream> // for ::print
 
-bool rect::is_null() const
-{
-       return m_x_max < m_x_min;
-}
+namespace gnash {
 
 void   rect::read(stream* in)
 {
        in->align();
        int     nbits = in->read_uint(5);
-       m_x_min = (float) in->read_sint(nbits);
-       m_x_max = (float) in->read_sint(nbits);
-       m_y_min = (float) in->read_sint(nbits);
-       m_y_max = (float) in->read_sint(nbits);
+       float xmin = (float) in->read_sint(nbits);
+       float xmax = (float) in->read_sint(nbits);
+       float ymin = (float) in->read_sint(nbits);
+       float ymax = (float) in->read_sint(nbits);
+
+       // TODO: check for swapper X or Y values,
+       //       or an assertion will fail !
+       _range.setTo(xmin, ymin, xmax, ymax);
 
 //             IF_DEBUG(log_msg("rect::read() nbits = %d\n", nbits));
 }
@@ -58,70 +46,20 @@
 // Debug spew.
 void   rect::print() const
 {
-       if ( is_null() )
-       {
-               log_parse(" null rectangle");
-       }
-       else
-       {
-       log_parse("xmin = %g, ymin = %g, xmax = %g, ymax = %g",
-               TWIPS_TO_PIXELS(m_x_min),
-               TWIPS_TO_PIXELS(m_y_min),
-               TWIPS_TO_PIXELS(m_x_max),
-               TWIPS_TO_PIXELS(m_y_max));
-       }
+       std::stringstream ss;
+       ss << _range;
+       log_parse("%s", ss.str().c_str());
 }
 
 
-bool   rect::point_test(float x, float y) const
-// Return true if the specified point is inside this rect.
-{
-       if ( is_null() ) return false;
-
-       if (x < m_x_min
-           || x > m_x_max
-           || y < m_y_min
-           || y > m_y_max)
-       {
-               return false;
-       }
-       else
-       {
-               return true;
-       }
-}
-
-
-void rect::enclose_point(float x, float y)
-{
-       m_y_min = m_y_max = y;
-       m_x_min = m_x_max = x;
-}
-
-void   rect::expand_to_point(float x, float y)
-{
-       if ( is_null() ) 
-       {
-               enclose_point(x,y);
-       }
-       else
-       {
-               m_x_min = fmin(m_x_min, x);
-               m_y_min = fmin(m_y_min, y);
-               m_x_max = fmax(m_x_max, x);
-               m_y_max = fmax(m_y_max, y);
-       }
-}
-
-
-point  rect::get_corner(int i) const
+point
+rect::get_corner(int i) const
 // Get one of the rect verts.
 {
-       assert ( ! is_null() ); // caller should check this
        assert(i >= 0 && i < 4);
        return point(
-               (i == 0 || i == 3) ? m_x_min : m_x_max,
-               (i < 2) ? m_y_min : m_y_max);
+               (i == 0 || i == 3) ? _range.getMinX() : _range.getMaxX(),
+               (i < 2) ? _range.getMinY() : _range.getMaxY() );
 }
 
 
@@ -130,7 +68,10 @@
 // by m.  This is an axial bound of an oriented (and/or
 // sheared, scaled, etc) box.
 {
-       assert ( ! r.is_null() ); // caller should check this
+       // Assertion unneeded as get_corner will
+       // do that
+       //assert ( ! _range.isNull() );
+
        // Get the transformed bounding box.
        point   p0, p1, p2, p3;
        m.transform(&p0, r.get_corner(0));
@@ -138,8 +79,7 @@
        m.transform(&p2, r.get_corner(2));
        m.transform(&p3, r.get_corner(3));
 
-       m_x_min = m_x_max = p0.m_x;
-       m_y_min = m_y_max = p0.m_y;
+       enclose_point(p0.m_x, p0.m_y);
        expand_to_point(p1.m_x, p1.m_y);
        expand_to_point(p2.m_x, p2.m_y);
        expand_to_point(p3.m_x, p3.m_y);
@@ -148,6 +88,7 @@
 void  rect::expand_to_rect(const rect& r) 
 {
        if ( r.is_null() ) return; // nothing to do
+
        point tmp;
        tmp = r.get_corner(0);  expand_to_point(tmp.m_x, tmp.m_y);    
        tmp = r.get_corner(1);  expand_to_point(tmp.m_x, tmp.m_y);    
@@ -178,19 +119,33 @@
 void   rect::set_lerp(const rect& a, const rect& b, float t)
 // Set this to the lerp of a and b.
 {
-       assert ( ! a.is_null() ); // caller should check this
-       assert ( ! b.is_null() ); // caller should check this
-       m_x_min = flerp(a.m_x_min, b.m_x_min, t);
-       m_y_min = flerp(a.m_y_min, b.m_y_min, t);
-       m_x_max = flerp(a.m_x_max, b.m_x_max, t);
-       m_y_max = flerp(a.m_y_max, b.m_y_max, t);
+       // Don't need to assert here, get_{x,y}_{min,max} will do that
+       //assert ( ! a.is_null() ); // caller should check this
+       //assert ( ! b.is_null() ); // caller should check this
+
+       // TODO: remove double calls to get_{x,y}_{min,max}
+       //       to remove double equivalent assertions
+       float xmin = flerp(a.get_x_min(), b.get_x_min(), t);
+       float ymin = flerp(a.get_y_min(), b.get_y_min(), t);
+       float xmax = flerp(a.get_x_max(), b.get_x_max(), t);
+       float ymax = flerp(a.get_y_max(), b.get_y_max(), t);
+
+       _range.setTo(xmin, ymin, xmax, ymax);
 }
 
 void
 rect::clamp(point& p) const
 {
-       p.m_x = fclamp(p.m_x, m_x_min, m_x_max);
-       p.m_y = fclamp(p.m_y, m_y_min, m_y_max);
+       // assertion unneeded, as get{Min,Max}{X,Y}
+       // will assert itself is called against
+       // a Null Range2d
+       //assert( ! _range.isNull() );
+
+       // nothing to do, point is surely inside
+       if ( _range.isWorld() ) return;
+
+       p.m_x = fclamp(p.m_x, _range.getMinX(), _range.getMaxX());
+       p.m_y = fclamp(p.m_y, _range.getMinY(), _range.getMaxY());
 }
 
 

Index: server/rect.h
===================================================================
RCS file: /sources/gnash/gnash/server/rect.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/rect.h       28 Nov 2006 15:59:30 -0000      1.11
+++ server/rect.h       1 Dec 2006 16:35:38 -0000       1.12
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: rect.h,v 1.11 2006/11/28 15:59:30 strk Exp $ */
+/* $Id: rect.h,v 1.12 2006/12/01 16:35:38 strk Exp $ */
 
 #ifndef GNASH_RECT_H
 #define GNASH_RECT_H
@@ -28,6 +28,8 @@
 
 #include "tu_config.h"
 
+#include "Range2d.h"
+
 #include <cassert> // for inlines
 
 // Forward decl
@@ -39,7 +41,11 @@
 
 namespace gnash {
 
-/// Rectangle class
+/// \brief
+/// Rectangle class, basically a wrapper around a
+/// gnash::geometry::Range2d<float> with a few
+/// additional methods for reading it from the
+/// stream ..
 //
 /// used by render handler (?)
 ///
@@ -47,56 +53,67 @@
 {
 private:
 
-       // TODO: make private 
-       float   m_x_min, m_x_max, m_y_min, m_y_max;
+       geometry::Range2d<float> _range;
 
 public:
 
        /// Construct a NULL rectangle
-       DSOEXPORT  rect();
+       rect()
+               :
+               _range()
+       {}
 
        /// Construct a rectangle with given coordinates
        rect(float xmin, float ymin, float xmax, float ymax)
                :
-               m_x_min(xmin),
-               m_x_max(xmax),
-               m_y_min(ymin),
-               m_y_max(ymax)
-       {
-               // use the default ctor to make a NULL rect
-               assert(m_x_min <= m_x_max);
-               assert(m_y_min <= m_y_max);
-               // .. or should we raise an exception .. ?
+               _range(xmin, ymin, xmax, ymax)
+       {
        }
 
        /// returns true if this is the NULL rectangle
-       DSOEXPORT bool is_null() const;
+       bool is_null() const
+       {
+               return _range.isNull();
+       }
 
        /// set the rectangle to the NULL value
-       void set_null();
+       void set_null()
+       {
+               _range.setNull();
+       }
 
        void    read(stream* in);
+
        void    print() const;
-       bool    point_test(float x, float y) const;
+
+       /// Return true if the specified point is inside this rect.
+       bool    point_test(float x, float y) const
+       {
+               return _range.contains(x, y);
+       }
 
        /// Expand this rectangle to enclose the given point.
-       void    expand_to_point(float x, float y);
+       void    expand_to_point(float x, float y)
+       {
+               _range.expandTo(x, y);
+       }
 
        /// Set ourself to bound the given point
-       void    enclose_point(float x, float y);
+       void    enclose_point(float x, float y)
+       {
+               _range.setTo(x, y);
+       }
 
        /// Return width this rectangle
        float   width() const
        {
-               if ( is_null() ) return 0;
-               return m_x_max-m_x_min;
+               return _range.width();
        }
 
        /// Return height this rectangle
        float   height() const
        {
-               if ( is_null() ) return 0;
-               return m_y_max-m_y_min;
+               return _range.height();
        }
 
        /// Shift this rectangle horizontally
@@ -106,9 +123,7 @@
        ///
        void shift_x(float offset)
        {
-               if ( is_null() ) return;
-               m_x_min += offset;
-               m_x_max += offset;
+               _range.shiftX(offset);
        }
 
        /// Shift this rectangle vertically
@@ -121,9 +136,7 @@
        ///
        void shift_y(float offset)
        {
-               if ( is_null() ) return;
-               m_y_min += offset;
-               m_y_max += offset;
+               _range.shiftY(offset);
        }
 
        /// Scale this rectangle horizontally
@@ -134,9 +147,7 @@
        ///
        void scale_x(float factor)
        {
-               if ( is_null() ) return;
-               m_x_min *= factor;
-               m_x_max *= factor;
+               _range.scaleX(factor);
        }
 
        /// Scale this rectangle vertically
@@ -147,9 +158,7 @@
        ///
        void scale_y(float factor)
        {
-               if ( is_null() ) return;
-               m_y_min *= factor;
-               m_y_max *= factor;
+               _range.scaleY(factor);
        }
 
        /// Get min X ordinate.
@@ -158,8 +167,7 @@
        ///
        float   get_x_min() const
        {
-               assert( ! is_null() );
-               return m_x_min;
+               return _range.getMinX();
        }
 
        /// Get max X ordinate.
@@ -168,8 +176,7 @@
        ///
        float   get_x_max() const
        {
-               assert( ! is_null() );
-               return m_x_max;
+               return _range.getMaxX();
        }
 
        /// Get min Y ordinate.
@@ -178,8 +185,7 @@
        ///
        float   get_y_min() const
        {
-               assert( ! is_null() );
-               return m_y_min;
+               return _range.getMinY();
        }
 
        /// Get max Y ordinate.
@@ -188,10 +194,13 @@
        ///
        float   get_y_max() const
        {
-               assert( ! is_null() );
-               return m_y_max;
+               return _range.getMaxY();
        }
 
+       /// Get one of the rect verts.
+       //
+       /// Don't call on a NULL rect !
+       ///
        /// TODO: deprecate this ?
        point   get_corner(int i) const;
 
@@ -199,6 +208,9 @@
        /// Make sure that the given point falls
        /// in this rectangle, modifying it's coordinates
        /// if needed.
+       ///
+       /// Don't call against a NULL rectangle !
+       ///
        void clamp(point& p) const;
 
        /// Set ourself to bound a rectangle that has been transformed

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/asobj/Makefile.am    28 Nov 2006 12:10:27 -0000      1.24
+++ server/asobj/Makefile.am    1 Dec 2006 16:35:38 -0000       1.25
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.24 2006/11/28 12:10:27 strk Exp $
+# $Id: Makefile.am,v 1.25 2006/12/01 16:35:38 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -31,6 +31,7 @@
        -I$(top_srcdir)/server/parser \
        -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
+       -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libamf \
         -I$(top_srcdir)        \
        $(PTHREAD_CFLAGS) \

Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/parser/Makefile.am   30 Nov 2006 13:25:42 -0000      1.19
+++ server/parser/Makefile.am   1 Dec 2006 16:35:38 -0000       1.20
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.19 2006/11/30 13:25:42 strk Exp $
+# $Id: Makefile.am,v 1.20 2006/12/01 16:35:38 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -36,6 +36,7 @@
        -I$(top_srcdir)/server/parser \
        -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libamf \
         -I$(top_srcdir)        \
        $(PTHREAD_CFLAGS) \

Index: server/parser/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_definition.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/parser/movie_definition.h    27 Nov 2006 15:57:51 -0000      1.11
+++ server/parser/movie_definition.h    1 Dec 2006 16:35:39 -0000       1.12
@@ -49,7 +49,7 @@
 #include "container.h"
 #include "timers.h" // for Timer
 #include "fontlib.h"
-#include "font.h"
+//#include "font.h"
 #include "jpeg.h"
 #include "tu_file.h"
 

Index: server/parser/video_stream_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/video_stream_def.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/parser/video_stream_def.h    27 Oct 2006 14:30:52 -0000      1.1
+++ server/parser/video_stream_def.h    1 Dec 2006 16:35:39 -0000       1.2
@@ -5,6 +5,7 @@
 #include "stream.h" // for read()
 #include "movie_definition.h"
 #include "swf.h"
+#include "rect.h" // for composition
 
 namespace gnash {
 

Index: server/vm/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/vm/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/vm/Makefile.am       28 Nov 2006 12:10:27 -0000      1.4
+++ server/vm/Makefile.am       1 Dec 2006 16:35:39 -0000       1.5
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.4 2006/11/28 12:10:27 strk Exp $
+# $Id: Makefile.am,v 1.5 2006/12/01 16:35:39 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -31,6 +31,7 @@
        -I$(top_srcdir)/server/swf \
        -I$(top_srcdir)/server/parser \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libamf \
         -I$(top_srcdir)        \
        $(PTHREAD_CFLAGS) \

Index: testsuite/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/Makefile.am,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- testsuite/Makefile.am       1 Dec 2006 15:38:18 -0000       1.24
+++ testsuite/Makefile.am       1 Dec 2006 16:35:39 -0000       1.25
@@ -29,6 +29,7 @@
        $(NULL)
 libtestsuite_la_CXXFLAGS = \
         -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/server  \
         -I$(top_srcdir)/server/parser  \
         -I$(top_srcdir)/server/vm  \

Index: utilities/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/utilities/Makefile.am,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- utilities/Makefile.am       24 Nov 2006 22:33:01 -0000      1.41
+++ utilities/Makefile.am       1 Dec 2006 16:35:39 -0000       1.42
@@ -41,6 +41,7 @@
 
 AM_CPPFLAGS = -I.. \
         -I$(top_srcdir)        \
+        -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)/server \
         -I$(top_srcdir)/server/parser \




reply via email to

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