Index: cc/math_util.cc |
diff --git a/cc/math_util.cc b/cc/math_util.cc |
index 481c4d69fd37db0cead1d156211ab80322e2a395..9f14395affe9bd1f39d644351b6de028d8073d1a 100644 |
--- a/cc/math_util.cc |
+++ b/cc/math_util.cc |
@@ -7,6 +7,7 @@ |
#include <cmath> |
#include <limits> |
+#include "base/values.h" |
#include "ui/gfx/quad_f.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/rect_conversions.h" |
@@ -385,4 +386,20 @@ gfx::Vector2dF MathUtil::projectVector(gfx::Vector2dF source, gfx::Vector2dF des |
return gfx::Vector2dF(projectedLength * destination.x(), projectedLength * destination.y()); |
} |
+static scoped_ptr<base::Value> asValue(gfx::PointF pt) { |
+ scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
+ res->SetDouble("x", pt.x()); |
+ res->SetDouble("y", pt.y()); |
+ return res.PassAs<base::Value>(); |
+} |
+ |
+static scoped_ptr<base::Value> asValue(gfx::QuadF q) { |
+ scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
+ res->Set("p1", asValue(q.p1()).release()); |
+ res->Set("p2", asValue(q.p2()).release()); |
+ res->Set("p3", asValue(q.p3()).release()); |
+ res->Set("p4", asValue(q.p4()).release()); |
+ return res.PassAs<base::Value>(); |
+} |
+ |
} // namespace cc |