Index: cc/base/math_util.cc |
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc |
index 39a183e27dbb35ffaef05f704f1dd821d33fb1ef..b9e715612fca9c6866dd62e274c5139da9e7848f 100644 |
--- a/cc/base/math_util.cc |
+++ b/cc/base/math_util.cc |
@@ -14,6 +14,7 @@ |
#include "ui/gfx/rect_conversions.h" |
#include "ui/gfx/rect_f.h" |
#include "ui/gfx/transform.h" |
+#include "ui/gfx/vector2d.h" |
#include "ui/gfx/vector2d_f.h" |
namespace cc { |
@@ -496,6 +497,20 @@ scoped_ptr<base::Value> MathUtil::AsValue(gfx::Rect r) { |
return res.PassAs<base::Value>(); |
} |
+scoped_ptr<base::Value> MathUtil::AsValue(gfx::Vector2d vec) { |
+ scoped_ptr<base::ListValue> res(new base::ListValue()); |
+ res->AppendInteger(vec.x()); |
+ res->AppendInteger(vec.y()); |
+ return res.PassAs<base::Value>(); |
+} |
+ |
+scoped_ptr<base::Value> MathUtil::AsValue(gfx::Vector2dF vec) { |
+ scoped_ptr<base::ListValue> res(new base::ListValue()); |
+ res->AppendDouble(vec.x()); |
+ res->AppendDouble(vec.y()); |
+ return res.PassAs<base::Value>(); |
+} |
+ |
bool MathUtil::FromValue(const base::Value* raw_value, gfx::Rect* out_rect) { |
const base::ListValue* value = NULL; |
if (!raw_value->GetAsList(&value)) |