Chromium Code Reviews| Index: ui/gfx/mojo/transform_struct_traits.h |
| diff --git a/ui/gfx/mojo/transform_struct_traits.h b/ui/gfx/mojo/transform_struct_traits.h |
| index a55122e40733067214ba5c6175ea5f06056df320..d3fb630480257574ee43f5bf3871cf9ddda2c334 100644 |
| --- a/ui/gfx/mojo/transform_struct_traits.h |
| +++ b/ui/gfx/mojo/transform_struct_traits.h |
| @@ -15,6 +15,8 @@ template <> |
| struct ArrayTraits<SkMatrix44> { |
| using Element = float; |
| + static bool IsNull(const SkMatrix44& input) { return input.isIdentity(); } |
|
Ian Vollick
2016/08/10 15:02:34
I'd prefer IsIdentity.
Ian Vollick
2016/08/10 15:13:57
Fady explained to me offline about how IsNull inte
Fady Samuel
2016/08/10 15:19:14
Mojo calls IsNull to determine whether a given fie
|
| + |
| static size_t GetSize(const SkMatrix44& input) { return 16; } |
| static float GetAt(const SkMatrix44& input, size_t index) { |
| @@ -32,6 +34,10 @@ struct StructTraits<gfx::mojom::Transform, gfx::Transform> { |
| static bool Read(gfx::mojom::TransformDataView data, gfx::Transform* out) { |
| ArrayDataView<float> matrix; |
| data.GetMatrixDataView(&matrix); |
| + if (matrix.is_null()) { |
| + out->MakeIdentity(); |
| + return true; |
| + } |
| out->matrix().setColMajorf(matrix.data()); |
| return true; |
| } |