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

Unified Diff: cc/base/math_util.cc

Issue 853393002: cc: refactor of MathUtil::AddToTracedValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « cc/base/math_util.h ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 816f6fc2c6e673efe56a9dc28a1efe8eab8fcc26..99c3cf3648754da31e0405021675f3521fb1ff87 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -733,59 +733,85 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::PointF& pt) {
return res.Pass();
}
-void MathUtil::AddToTracedValue(const gfx::Size& s,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Size& s,
base::debug::TracedValue* res) {
+ res->BeginDictionary(name);
res->SetDouble("width", s.width());
res->SetDouble("height", s.height());
+ res->EndDictionary();
}
-void MathUtil::AddToTracedValue(const gfx::SizeF& s,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::SizeF& s,
base::debug::TracedValue* res) {
+ res->BeginDictionary(name);
res->SetDouble("width", s.width());
res->SetDouble("height", s.height());
+ res->EndDictionary();
}
-void MathUtil::AddToTracedValue(const gfx::Rect& r,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Rect& r,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendInteger(r.x());
res->AppendInteger(r.y());
res->AppendInteger(r.width());
res->AppendInteger(r.height());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::PointF& pt,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::PointF& pt,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(pt.x());
res->AppendDouble(pt.y());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::Point3F& pt,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Point3F& pt,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(pt.x());
res->AppendDouble(pt.y());
res->AppendDouble(pt.z());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::Vector2d& v,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Vector2d& v,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendInteger(v.x());
res->AppendInteger(v.y());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::Vector2dF& v,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Vector2dF& v,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(v.x());
res->AppendDouble(v.y());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::ScrollOffset& v,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::ScrollOffset& v,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(v.x());
res->AppendDouble(v.y());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::QuadF& q,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::QuadF& q,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(q.p1().x());
res->AppendDouble(q.p1().y());
res->AppendDouble(q.p2().x());
@@ -794,33 +820,43 @@ void MathUtil::AddToTracedValue(const gfx::QuadF& q,
res->AppendDouble(q.p3().y());
res->AppendDouble(q.p4().x());
res->AppendDouble(q.p4().y());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::RectF& rect,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::RectF& rect,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendDouble(rect.x());
res->AppendDouble(rect.y());
res->AppendDouble(rect.width());
res->AppendDouble(rect.height());
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::Transform& transform,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::Transform& transform,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
const SkMatrix44& m = transform.matrix();
for (int row = 0; row < 4; ++row) {
for (int col = 0; col < 4; ++col)
res->AppendDouble(m.getDouble(row, col));
}
+ res->EndArray();
}
-void MathUtil::AddToTracedValue(const gfx::BoxF& box,
+void MathUtil::AddToTracedValue(const char* name,
+ const gfx::BoxF& box,
base::debug::TracedValue* res) {
+ res->BeginArray(name);
res->AppendInteger(box.x());
res->AppendInteger(box.y());
res->AppendInteger(box.z());
res->AppendInteger(box.width());
res->AppendInteger(box.height());
res->AppendInteger(box.depth());
+ res->EndArray();
}
double MathUtil::AsDoubleSafely(double value) {
« no previous file with comments | « cc/base/math_util.h ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698