OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/skia/type_converters.h" | 5 #include "mojo/skia/type_converters.h" |
6 | 6 |
7 namespace mojo { | 7 namespace mojo { |
8 | 8 |
9 SkIPoint TypeConverter<SkIPoint, mojo::Point>::Convert( | 9 SkIPoint TypeConverter<SkIPoint, mojo::Point>::Convert( |
10 const mojo::Point& input) { | 10 const mojo::Point& input) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 output->matrix[9] = 0.f; | 119 output->matrix[9] = 0.f; |
120 output->matrix[10] = 1.f; | 120 output->matrix[10] = 1.f; |
121 output->matrix[11] = 0.f; | 121 output->matrix[11] = 0.f; |
122 output->matrix[12] = input[6]; | 122 output->matrix[12] = input[6]; |
123 output->matrix[13] = input[7]; | 123 output->matrix[13] = input[7]; |
124 output->matrix[14] = 0.f; | 124 output->matrix[14] = 0.f; |
125 output->matrix[15] = input[8]; | 125 output->matrix[15] = input[8]; |
126 return output.Pass(); | 126 return output.Pass(); |
127 } | 127 } |
128 | 128 |
| 129 SkMatrix44 TypeConverter<SkMatrix44, mojo::TransformPtr>::Convert( |
| 130 const mojo::TransformPtr& input) { |
| 131 if (!input) |
| 132 return SkMatrix44::I(); |
| 133 |
| 134 SkMatrix44 output(SkMatrix44::kUninitialized_Constructor); |
| 135 output.setRowMajorf(input->matrix.data()); |
| 136 return output; |
| 137 } |
| 138 |
| 139 mojo::TransformPtr TypeConverter<mojo::TransformPtr, SkMatrix44>::Convert( |
| 140 const SkMatrix44& input) { |
| 141 auto output = mojo::Transform::New(); |
| 142 output->matrix.resize(16u); |
| 143 input.asRowMajorf(output->matrix.data()); |
| 144 return output.Pass(); |
| 145 } |
| 146 |
129 } // namespace mojo | 147 } // namespace mojo |
OLD | NEW |