Bug 1231245 - Fix logging of Matrix4x4. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 09 Dec 2015 11:03:21 -0500
changeset 276016 e14b7deb2fdafaef9f11a48f83c81dcc318ed2a9
parent 276015 94f4cfa98356714223ee71774f27a9153b6ab188
child 276017 a0920d7f00a0550b66ba5b93c20db195497ab560
push id29781
push usercbook@mozilla.com
push dateThu, 10 Dec 2015 11:07:51 +0000
treeherdermozilla-central@412e4d7ce98c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1231245
milestone45.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 1231245 - Fix logging of Matrix4x4. r=botond
gfx/layers/LayersLogging.cpp
gfx/layers/LayersLogging.h
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -222,36 +222,16 @@ AppendToString(std::stringstream& aStrea
     aStream << nsPrintfCString(
       "[ %g %g; %g %g; %g %g; ]",
       m._11, m._12, m._21, m._22, m._31, m._32).get();
   }
   aStream << sfx;
 }
 
 void
-AppendToString(std::stringstream& aStream, const Matrix4x4& m,
-               const char* pfx, const char* sfx)
-{
-  if (m.Is2D()) {
-    Matrix matrix = m.As2D();
-    AppendToString(aStream, matrix, pfx, sfx);
-    return;
-  }
-
-  aStream << pfx;
-  aStream << nsPrintfCString(
-    "[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; ]",
-    m._11, m._12, m._13, m._14,
-    m._21, m._22, m._23, m._24,
-    m._31, m._32, m._33, m._34,
-    m._41, m._42, m._43, m._44).get();
-  aStream << sfx;
-}
-
-void
 AppendToString(std::stringstream& aStream, const Matrix5x4& m,
                const char* pfx, const char* sfx)
 {
   aStream << pfx;
   aStream << nsPrintfCString(
     "[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g]",
     m._11, m._12, m._13, m._14,
     m._21, m._22, m._23, m._24,
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -2,17 +2,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_LAYERSLOGGING_H
 #define GFX_LAYERSLOGGING_H
 
 #include "FrameMetrics.h"               // for FrameMetrics, etc
-#include "mozilla/gfx/MatrixFwd.h"      // for Matrix4x4
+#include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize, etc
 #include "mozilla/gfx/Types.h"          // for Filter, SurfaceFormat
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags
 #include "nsAString.h"
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "nsRegion.h"                   // for nsRegion, nsIntRegion
 #include "nscore.h"                     // for nsACString, etc
 
@@ -180,19 +180,36 @@ AppendToString(std::stringstream& aStrea
   aStream.precision(oldPrecision);
   aStream << sfx;
 }
 
 void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::Matrix& m,
                const char* pfx="", const char* sfx="");
 
+template<class SourceUnits, class TargetUnits>
 void
-AppendToString(std::stringstream& aStream, const mozilla::gfx::Matrix4x4& m,
-               const char* pfx="", const char* sfx="");
+AppendToString(std::stringstream& aStream, const mozilla::gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& m,
+               const char* pfx="", const char* sfx="")
+{
+  if (m.Is2D()) {
+    mozilla::gfx::Matrix matrix = m.As2D();
+    AppendToString(aStream, matrix, pfx, sfx);
+    return;
+  }
+
+  aStream << pfx;
+  aStream << nsPrintfCString(
+    "[ %g %g %g %g; %g %g %g %g; %g %g %g %g; %g %g %g %g; ]",
+    m._11, m._12, m._13, m._14,
+    m._21, m._22, m._23, m._24,
+    m._31, m._32, m._33, m._34,
+    m._41, m._42, m._43, m._44).get();
+  aStream << sfx;
+}
 
 void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::Matrix5x4& m,
                const char* pfx="", const char* sfx="");
 
 void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::Filter filter,
                const char* pfx="", const char* sfx="");