gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/matrix.cpp server/matrix.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/matrix.cpp server/matrix.h
Date: Wed, 11 Oct 2006 09:03:57 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/11 09:03:57

Modified files:
        .              : ChangeLog 
        server         : matrix.cpp matrix.h 

Log message:
        added equality and output operators

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1131&r2=1.1132
http://cvs.savannah.gnu.org/viewcvs/gnash/server/matrix.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/matrix.h?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1131
retrieving revision 1.1132
diff -u -b -r1.1131 -r1.1132
--- ChangeLog   11 Oct 2006 08:08:36 -0000      1.1131
+++ ChangeLog   11 Oct 2006 09:03:56 -0000      1.1132
@@ -1,5 +1,6 @@
 2006-10-11 Sandro Santilli <address@hidden>
 
+       * server/matrix.{cpp,h}: added equality and output operators.
        * server/Makefile.am, server/gnash.h, server/matrix.cpp,
          server/matrix.h, server/movie.h, server/types.cpp:
          moved matrix class in its own files and added/fixed

Index: server/matrix.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/matrix.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/matrix.cpp   11 Oct 2006 08:08:36 -0000      1.1
+++ server/matrix.cpp   11 Oct 2006 09:03:56 -0000      1.2
@@ -36,7 +36,7 @@
 //
 // Original author: Thatcher Ulrich <address@hidden> 2003
 //
-// $Id: matrix.cpp,v 1.1 2006/10/11 08:08:36 strk Exp $ 
+// $Id: matrix.cpp,v 1.2 2006/10/11 09:03:56 strk Exp $ 
 //
 
 #ifdef HAVE_CONFIG_H
@@ -87,6 +87,21 @@
        m_[1][1] = 1;
 }
 
+std::ostream& operator<< (std::ostream& os, const matrix& m)
+{
+       os << "| " << m.m_[0][0] << " "
+               << m.m_[0][1] << " "
+               << TWIPS_TO_PIXELS(m.m_[0][2]) << " |"
+               << std::endl;
+
+       os << "| " << m.m_[1][0] << " "
+               << m.m_[1][1] << " "
+               << TWIPS_TO_PIXELS(m.m_[1][2])
+               << " |" << std::endl;
+
+       return os;
+}
+
 
 void
 matrix::concatenate(const matrix& m)

Index: server/matrix.h
===================================================================
RCS file: /sources/gnash/gnash/server/matrix.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/matrix.h     11 Oct 2006 08:08:36 -0000      1.1
+++ server/matrix.h     11 Oct 2006 09:03:56 -0000      1.2
@@ -36,7 +36,7 @@
 //
 // Original author: Thatcher Ulrich <address@hidden> 2003
 //
-// $Id: matrix.h,v 1.1 2006/10/11 08:08:36 strk Exp $ 
+// $Id: matrix.h,v 1.2 2006/10/11 09:03:56 strk Exp $ 
 //
 
 #ifndef GNASH_MATRIX_H
@@ -46,7 +46,9 @@
 #include "config.h"
 #endif
 
-#include "tu_config.h"
+#include "tu_config.h" // for DSOEXPORT
+
+#include <iosfwd>
 
 namespace gnash {
 
@@ -70,14 +72,9 @@
 class DSOEXPORT matrix
 {
 public:
-       /// \brief
-       /// Top two rows of a 3x3 matrix whose bottom row is 
-       /// assumed to be | 0 0 1 |
-       ///
-       ///     | scale_x  x_dep_y  translate_x |
-       ///     | y_dep_x  scale_y  translate_y |
-       ///
-       float   m_[2][3];
+       
+       friend bool operator== (const matrix&, const matrix&);
+       friend std::ostream& operator<< (std::ostream&, const matrix&);
        
        /// The identity matrix (no transforms)
        //
@@ -172,8 +169,29 @@
 
        /// return our rotation component (in radians)
        float   get_rotation() const;
+
+public: // must be switched to private
+
+       /// \brief
+       /// Top two rows of a 3x3 matrix whose bottom row is 
+       /// assumed to be | 0 0 1 |
+       ///
+       ///     | scale_x  x_dep_y  translate_x |
+       ///     | y_dep_x  scale_y  translate_y |
+       ///
+       float   m_[2][3];
 };
 
+inline bool operator== (const matrix& a, const matrix& b)
+{
+       return  a.m_[0][0] == b.m_[0][0] &&
+               a.m_[0][1] == b.m_[0][1] &&
+               a.m_[0][2] == b.m_[0][2] &&
+               a.m_[1][0] == b.m_[1][0] &&
+               a.m_[1][1] == b.m_[1][1] &&
+               a.m_[1][2] == b.m_[1][2];
+}
+
 
 }      // namespace gnash
 




reply via email to

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