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

Unified Diff: ui/gfx/mojo/transform_struct_traits.h

Issue 2231013002: ui/gfx mojo: Don't serialize the identity matrix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « ui/gfx/mojo/transform.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « ui/gfx/mojo/transform.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698