| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cdf36489bea48c9c7ffb82475650229464cc0724
|
| --- /dev/null
|
| +++ b/ui/gfx/mojo/transform_struct_traits.h
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_GFX_IPC_TRANSFORM_STRUCT_TRAITS_H_
|
| +#define UI_GFX_IPC_TRANSFORM_STRUCT_TRAITS_H_
|
| +
|
| +#include "ui/gfx/mojo/transform.mojom.h"
|
| +#include "ui/gfx/transform.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +template <>
|
| +struct StructTraits<gfx::mojom::Transform, gfx::Transform> {
|
| + static mojo::Array<float> matrix(const gfx::Transform& transform) {
|
| + std::vector<float> storage(16);
|
| + transform.matrix().asRowMajorf(&storage[0]);
|
| + mojo::Array<float> matrix;
|
| + matrix.Swap(&storage);
|
| + return matrix;
|
| + }
|
| +
|
| + static bool Read(gfx::mojom::TransformDataView data, gfx::Transform* out) {
|
| + mojo::Array<float> matrix;
|
| + if (!data.ReadMatrix(&matrix))
|
| + return false;
|
| + out->matrix().setRowMajorf(&matrix.storage()[0]);
|
| + return true;
|
| + }
|
| +};
|
| +
|
| +} // namespace mojo
|
| +
|
| +#endif // UI_GFX_IPC_TRANSFORM_STRUCT_TRAITS_H_
|
|
|