Bug 1400378 - Add layers logging support for Point3D. r=mattwoodrow
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 15 Sep 2017 16:08:12 -0400
changeset 665716 a6d9e37a9122e0848b67c072b7a101fe4b058716
parent 665715 9cc10d12de94bda1dee61a03e0681f5e73df5ee6
child 665717 d6a3a83d9ce3c16773a5c818b5f754ff7728f665
push id80148
push userbmo:emilio@crisal.io
push dateFri, 15 Sep 2017 20:59:22 +0000
reviewersmattwoodrow
bugs1400378
milestone57.0a1
Bug 1400378 - Add layers logging support for Point3D. r=mattwoodrow MozReview-Commit-ID: 9W3gDi7wyQF
gfx/2d/BasePoint3D.h
gfx/layers/LayersLogging.h
--- a/gfx/2d/BasePoint3D.h
+++ b/gfx/2d/BasePoint3D.h
@@ -109,14 +109,18 @@ struct BasePoint3D {
   T Length() const {
       return sqrt(x*x + y*y + z*z);
   }
 
   // Invalid for points with distance from origin of 0.
   void Normalize() {
       *this /= Length();
   }
+
+  friend std::ostream& operator<<(std::ostream& stream, const BasePoint3D<T, Sub>& aPoint) {
+    return stream << '(' << aPoint.x << ',' << aPoint.y << ',' << aPoint.z << ')';
+  }
 };
 
 } // namespace gfx
 } // namespace mozilla
 
 #endif /* MOZILLA_BASEPOINT3D_H_ */
--- a/gfx/layers/LayersLogging.h
+++ b/gfx/layers/LayersLogging.h
@@ -66,16 +66,24 @@ void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::PointTyped<T>& p,
                const char* pfx="", const char* sfx="")
 {
   aStream << pfx << p << sfx;
 }
 
 template<class T>
 void
+AppendToString(std::stringstream& aStream, const mozilla::gfx::Point3DTyped<T>& p,
+               const char* pfx="", const char* sfx="")
+{
+  aStream << pfx << p << sfx;
+}
+
+template<class T>
+void
 AppendToString(std::stringstream& aStream, const mozilla::gfx::IntPointTyped<T>& p,
                const char* pfx="", const char* sfx="")
 {
   aStream << pfx << p << sfx;
 }
 
 template<class T>
 void