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

Unified Diff: third_party/WebKit/Source/platform/geometry/FloatRoundedRect.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: Fewer redundant spaces, more toString tests Created 4 years, 4 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/FloatRoundedRect.cpp
diff --git a/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp b/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
index 245a96b25ccda2c40f706d5053d388d86e739923..a59b533421e38a9fd756086029b1859a7c9ed8d3 100644
--- a/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
+++ b/third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
@@ -30,13 +30,9 @@
#include "platform/geometry/FloatRoundedRect.h"
#include "platform/geometry/FloatQuad.h"
-
+#include "wtf/text/WTFString.h"
#include <algorithm>
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
-
namespace blink {
FloatRoundedRect::FloatRoundedRect(float x, float y, float width, float height)
@@ -140,15 +136,6 @@ void FloatRoundedRect::Radii::expand(float topWidth, float bottomWidth, float le
}
}
-#ifndef NDEBUG
-void FloatRoundedRect::Radii::show() const
-{
- fprintf(stderr, "topLeft=[%f,%f], topRight=[%f,%f], bottomLeft=[%f,%f], bottomRight=[%f,%f]\n",
- topLeft().width(), topLeft().height(), topRight().width(), topRight().height(),
- bottomLeft().width(), bottomLeft().height(), bottomRight().width(), bottomRight().height());
-}
-#endif
-
static inline float cornerRectIntercept(float y, const FloatRect& cornerRect)
{
ASSERT(cornerRect.height() > 0);
@@ -349,14 +336,20 @@ void FloatRoundedRect::adjustRadii()
m_radii.scale(widthRatio < heightRatio ? widthRatio : heightRatio);
}
-#ifndef NDEBUG
-void FloatRoundedRect::show() const
+String FloatRoundedRect::Radii::toString() const
+{
+ return String::format("tl:%s; tr:%s; bl:%s; br:%s",
+ topLeft().toString().ascii().data(),
+ topRight().toString().ascii().data(),
+ bottomLeft().toString().ascii().data(),
+ bottomRight().toString().ascii().data());
+}
+
+String FloatRoundedRect::toString() const
{
- fprintf(stderr, "FloatRoundedRect:\n rect: ");
- m_rect.show();
- fprintf(stderr, " radii: ");
- m_radii.show();
+ return String::format("%s radii:(%s)",
+ rect().toString().ascii().data(),
+ getRadii().toString().ascii().data());
}
-#endif
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698