OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/converters/transform/transform_converters.h" |
| 6 |
| 7 namespace mojo { |
| 8 |
| 9 // static |
| 10 TransformPtr TypeConverter<TransformPtr, gfx::Transform>::Convert( |
| 11 const gfx::Transform& input) { |
| 12 std::vector<float> storage(16); |
| 13 input.matrix().asRowMajorf(&storage[0]); |
| 14 mojo::Array<float> matrix; |
| 15 matrix.Swap(&storage); |
| 16 TransformPtr transform(Transform::New()); |
| 17 transform->matrix = matrix.Pass(); |
| 18 return transform.Pass(); |
| 19 } |
| 20 |
| 21 // static |
| 22 gfx::Transform TypeConverter<gfx::Transform, TransformPtr>::Convert( |
| 23 const TransformPtr& input) { |
| 24 if (input.is_null()) |
| 25 return gfx::Transform(); |
| 26 gfx::Transform transform(gfx::Transform::kSkipInitialization); |
| 27 transform.matrix().setRowMajorf(&input->matrix.storage()[0]); |
| 28 return transform; |
| 29 } |
| 30 |
| 31 } // namespace mojo |
OLD | NEW |