Bug 1400378 - Add layers logging support for Point3D. r?mattwoodrow
MozReview-Commit-ID: 9W3gDi7wyQF
--- 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