Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: third_party/WebKit/Source/platform/geometry/FloatQuad.cpp

Issue 2191233002: Add platform/geometry pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust tests to work around uninteresting cross-platform differences Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/FloatQuad.cpp b/third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
index 3759aa67fff91a2a20e4af7ba4418b90c2a92f63..62e732b08e5cabb429fb54e1bb796d9b844de8a9 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
@@ -34,10 +34,7 @@
#include <algorithm>
#include <cmath>
#include <limits>
-
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
+#include <ostream> // NOLINT
namespace blink {
@@ -252,11 +249,14 @@ bool FloatQuad::isCounterclockwise() const
return determinant(m_p2 - m_p1, m_p3 - m_p2) < 0;
}
-#ifndef NDEBUG
-void FloatQuad::show() const
+std::ostream& operator<<(std::ostream& os, const FloatQuad& quad)
{
- fprintf(stderr, "FloatQuad: [p1=(%f,%f), p2=(%f,%f), p3=(%f,%f), p4=(%f,%f))]\n", m_p1.x(), m_p1.y(), m_p2.x(), m_p2.y(), m_p3.x(), m_p3.y(), m_p4.x(), m_p4.y());
+ os << "FloatQuad("
+ << "p1=(" << quad.p1().x() << ", " << quad.p1().y() << "), "
+ << "p2=(" << quad.p2().x() << ", " << quad.p2().y() << "), "
+ << "p3=(" << quad.p3().x() << ", " << quad.p3().y() << "), "
+ << "p4=(" << quad.p4().x() << ", " << quad.p4().y() << "))";
+ return os;
}
-#endif
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698