Index: cc/base/math_util.cc |
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc |
index 39a183e27dbb35ffaef05f704f1dd821d33fb1ef..fa7b21a8c29ddbe7f95746ba62c8697ea28ab89d 100644 |
--- a/cc/base/math_util.cc |
+++ b/cc/base/math_util.cc |
@@ -487,6 +487,13 @@ scoped_ptr<base::Value> MathUtil::AsValue(gfx::Size s) { |
return res.PassAs<base::Value>(); |
} |
+scoped_ptr<base::Value> MathUtil::AsValue(gfx::SizeF s) { |
+ scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
+ res->SetDouble("width", s.width()); |
+ res->SetDouble("height", s.height()); |
+ return res.PassAs<base::Value>(); |
+} |
+ |
scoped_ptr<base::Value> MathUtil::AsValue(gfx::Rect r) { |
scoped_ptr<base::ListValue> res(new base::ListValue()); |
res->AppendInteger(r.x()); |
@@ -546,6 +553,16 @@ scoped_ptr<base::Value> MathUtil::AsValue(const gfx::RectF& rect) { |
return res.PassAs<base::Value>(); |
} |
+scoped_ptr<base::Value> MathUtil::AsValue(const gfx::Transform& transform) { |
+ scoped_ptr<base::ListValue> res(new base::ListValue()); |
+ 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)); |
+ } |
+ return res.PassAs<base::Value>(); |
+} |
+ |
scoped_ptr<base::Value> MathUtil::AsValueSafely(double value) { |
return scoped_ptr<base::Value>(base::Value::CreateDoubleValue( |
std::min(value, std::numeric_limits<double>::max()))); |