gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Matrix_...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Matrix_...
Date: Sat, 07 Jun 2008 16:27:17 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/06/07 16:27:17

Modified files:
        .              : ChangeLog 
        server/asobj/flash/geom: Matrix_as.cpp Matrix_as.h Point_as.cpp 
                                 Point_as.h 

Log message:
                * server/asobj/flash/geom/Point_as{h,cpp}: move class 
declaration
                  back into the implementation file and implement the handy 
auto_ptr
                  function that was lying about (thanks strk).
                * server/asobj/flash/geom/Matrix_as.{cpp,h}: add
                  getFlashGeomMatrixConstructor() in header (will probably be
                  needed).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6855&r2=1.6856
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Matrix_as.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Matrix_as.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.h?cvsroot=gnash&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6855
retrieving revision 1.6856
diff -u -b -r1.6855 -r1.6856
--- ChangeLog   7 Jun 2008 14:14:18 -0000       1.6855
+++ ChangeLog   7 Jun 2008 16:27:15 -0000       1.6856
@@ -1,3 +1,12 @@
+2008-06-07 Benjamin Wolsey <address@hidden>
+
+       * server/asobj/flash/geom/Point_as{h,cpp}: move class declaration
+         back into the implementation file and implement the handy auto_ptr
+         function that was lying about (thanks strk).
+       * server/asobj/flash/geom/Matrix_as.{cpp,h}: add
+         getFlashGeomMatrixConstructor() in header (will probably be
+         needed).
+
 2008-06-07  Rob Savoye  <address@hidden>
 
        * Makefile.am: Include xpi.am for XPI packages.

Index: server/asobj/flash/geom/Matrix_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Matrix_as.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/flash/geom/Matrix_as.cpp       7 Jun 2008 12:11:33 -0000       
1.7
+++ server/asobj/flash/geom/Matrix_as.cpp       7 Jun 2008 16:27:16 -0000       
1.8
@@ -37,15 +37,22 @@
 #include <boost/numeric/ublas/matrix.hpp> // boost matrix
 #include <boost/numeric/ublas/io.hpp>
 #include <sstream>
+#include <memory> // std::auto_ptr
 
+/// According to senocular, Flash docs get this wrong (b and c swapped).
+/// However, most of the transformations only apply to a
+/// subset of the elements, so it's unnecessary to use a full 3x3 matrix for
+/// every operation.
+///
 // A transformation matrix for affine transformations:
-//    a  b  tx
-//    c  d  ty
+//    a  c  tx
+//    b  d  ty
 //    0  0  1
 // The matrix can only operate in 2d space.
 
 namespace gnash {
 
+// Forward declarations
 static as_value Matrix_clone(const fn_call& fn);
 static as_value Matrix_concat(const fn_call& fn);
 static as_value Matrix_createBox(const fn_call& fn);
@@ -130,6 +137,18 @@
 
 };
 
+as_function* getFlashGeomMatrixConstructor()
+{
+    static builtin_function* cl = NULL;
+    if ( ! cl )
+    {
+        cl=new builtin_function(&Matrix_ctor, getMatrixInterface());
+        VM::get().addStatic(cl);
+        attachMatrixStaticProperties(*cl);
+    }
+    return cl;
+}
+
 /// Return an exact copy of the matrix.
 static as_value
 Matrix_clone(const fn_call& fn)
@@ -253,8 +272,8 @@
     // Transform
     point = boost::numeric::ublas::prod(point, transformMatrix);
 
-    // Return new point
-    boost::intrusive_ptr<as_object> ret = new Point_as;
+    // Get an auto_ptr to a Point and keep alive.
+    boost::intrusive_ptr<as_object> ret = init_Point_instance().release();
        ret->set_member(NSV::PROP_X, point(0));
        ret->set_member(NSV::PROP_Y, point(1));
 
@@ -395,7 +414,7 @@
         ptr->set_member(NSV::PROP_C, as_value(currentMatrix(1, 0)));
         ptr->set_member(NSV::PROP_D, as_value(currentMatrix(1, 1)));
 
-        // This isn't how to multiply matrices...
+        // This is just a simple multiplication, so do it separately.
         ptr->set_member(NSV::PROP_TX, as_value(tx.to_number() * scaleX));
         ptr->set_member(NSV::PROP_TY, as_value(ty.to_number() * scaleY));  
     }      
@@ -630,17 +649,6 @@
        return as_value(obj.get()); // will keep alive
 }
 
-as_function* getFlashGeomMatrixConstructor()
-{
-       static builtin_function* cl = NULL;
-       if ( ! cl )
-       {
-               cl=new builtin_function(&Matrix_ctor, getMatrixInterface());
-               VM::get().addStatic(cl);
-               attachMatrixStaticProperties(*cl);
-       }
-       return cl;
-}
 
 static as_value
 get_flash_geom_matrix_constructor(const fn_call& /*fn*/)

Index: server/asobj/flash/geom/Matrix_as.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Matrix_as.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/flash/geom/Matrix_as.h 7 Jun 2008 12:11:33 -0000       1.2
+++ server/asobj/flash/geom/Matrix_as.h 7 Jun 2008 16:27:16 -0000       1.3
@@ -29,6 +29,7 @@
 namespace gnash {
 
 class as_object;
+class as_function;
 
 /// Initialize the global Matrix class
 void Matrix_class_init(as_object& global);
@@ -36,6 +37,9 @@
 /// Return a Matrix instance (in case the core lib needs it)
 //std::auto_ptr<as_object> init_Matrix_instance();
 
+// This will probably be needed by other geom classes.
+as_function* getFlashGeomMatrixConstructor();
+
 } // end of gnash namespace
 
 // __GNASH_ASOBJ_MATRIX_H__

Index: server/asobj/flash/geom/Point_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/asobj/flash/geom/Point_as.cpp        7 Jun 2008 12:11:34 -0000       
1.15
+++ server/asobj/flash/geom/Point_as.cpp        7 Jun 2008 16:27:16 -0000       
1.16
@@ -89,12 +89,16 @@
        return o.get();
 }
 
-Point_as::Point_as()
+
+class Point_as: public as_object
+{
+public:
+       Point_as()
                :
        as_object(getPointInterface())
-{
-}
+       {}
 
+};
 
 
 static as_value
@@ -667,6 +671,11 @@
        return getFlashGeomPointConstructor();
 }
 
+std::auto_ptr<as_object> init_Point_instance()
+{
+    return std::auto_ptr<as_object>(new Point_as);
+}
+
 // extern 
 void Point_class_init(as_object& where)
 {

Index: server/asobj/flash/geom/Point_as.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/flash/geom/Point_as.h  7 Jun 2008 12:11:34 -0000       1.3
+++ server/asobj/flash/geom/Point_as.h  7 Jun 2008 16:27:16 -0000       1.4
@@ -20,30 +20,22 @@
 #ifndef GNASH_ASOBJ_POINT_H
 #define GNASH_ASOBJ_POINT_H
 
-#include "as_object.h" // For inheritance
-
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-//#include <memory> // for auto_ptr
+#include "as_object.h" // For visibility to auto_ptr
+#include <memory> // for auto_ptr
 
 namespace gnash {
 
 class as_function;
 
-// The Point class is needed by Matrix
-class Point_as: public as_object
-{
-public:
-       Point_as();
-};
-
 /// Initialize the global Point class
 void Point_class_init(as_object& global);
 
 /// Return a Point instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_Point_instance();
+std::auto_ptr<as_object> init_Point_instance();
 
 /// Return the Point constructor, for use by Rectangle 
 as_function* getFlashGeomPointConstructor();




reply via email to

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