Bug 1065526, part 2 - Add a Copy() method to gfxMatrix. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Wed, 10 Sep 2014 21:41:51 +0100
changeset 227903 1c30f59cc34be036a1f3704d07eb62ef83acc712
parent 227902 f758f49893e5fb1dae808521a56ca57623a7e5fb
child 227904 3a7a4cb3a619e18c12de711537cdcf62bf08fcb3
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1065526
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1065526, part 2 - Add a Copy() method to gfxMatrix. r=Bas
gfx/thebes/gfxMatrix.h
--- a/gfx/thebes/gfxMatrix.h
+++ b/gfx/thebes/gfxMatrix.h
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_MATRIX_H
 #define GFX_MATRIX_H
 
 #include "gfxPoint.h"
 #include "gfxTypes.h"
 #include "gfxRect.h"
+#include "mozilla/Attributes.h"
 
 // XX - I don't think this class should use gfxFloat at all,
 // but should use 'double' and be called gfxDoubleMatrix;
 // we can then typedef that to gfxMatrix where we typedef
 // double to be gfxFloat.
 
 /**
  * A matrix that represents an affine transformation. Projective
@@ -45,16 +46,20 @@ public:
      * Initializes the matrix from individual components. See the class
      * description for the layout of the matrix.
      */
     gfxMatrix(gfxFloat a, gfxFloat b, gfxFloat c, gfxFloat d, gfxFloat tx, gfxFloat ty) :
         _11(a),  _12(b),
         _21(c),  _22(d),
         _31(tx), _32(ty) { }
 
+    MOZ_ALWAYS_INLINE gfxMatrix Copy() const {
+        return gfxMatrix(*this);
+    }
+
     friend std::ostream& operator<<(std::ostream& stream, const gfxMatrix& m) {
       if (m.IsIdentity()) {
         return stream << "[identity]";
       }
 
       return stream << "["
              << m._11 << " " << m._12
              << m._21 << " " << m._22