| 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 #ifndef MOJO_SKIA_TYPE_CONVERTERS_H_ | 5 #ifndef MOJO_SKIA_TYPE_CONVERTERS_H_ |
| 6 #define MOJO_SKIA_TYPE_CONVERTERS_H_ | 6 #define MOJO_SKIA_TYPE_CONVERTERS_H_ |
| 7 | 7 |
| 8 #include "mojo/services/geometry/interfaces/geometry.mojom.h" | 8 #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
| 9 #include "third_party/skia/include/core/SkMatrix.h" | 9 #include "third_party/skia/include/core/SkMatrix.h" |
| 10 #include "third_party/skia/include/core/SkPoint.h" | 10 #include "third_party/skia/include/core/SkPoint.h" |
| 11 #include "third_party/skia/include/core/SkRRect.h" | 11 #include "third_party/skia/include/core/SkRRect.h" |
| 12 #include "third_party/skia/include/core/SkRect.h" | 12 #include "third_party/skia/include/core/SkRect.h" |
| 13 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 | 16 |
| 16 template <> | 17 template <> |
| 17 struct TypeConverter<SkIPoint, mojo::Point> { | 18 struct TypeConverter<SkIPoint, mojo::Point> { |
| 18 static SkIPoint Convert(const mojo::Point& input); | 19 static SkIPoint Convert(const mojo::Point& input); |
| 19 }; | 20 }; |
| 20 template <> | 21 template <> |
| 21 struct TypeConverter<mojo::Point, SkIPoint> { | 22 struct TypeConverter<mojo::Point, SkIPoint> { |
| 22 static mojo::Point Convert(const SkIPoint& input); | 23 static mojo::Point Convert(const SkIPoint& input); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 52 template <> | 53 template <> |
| 53 struct TypeConverter<SkRRect, mojo::RRectF> { | 54 struct TypeConverter<SkRRect, mojo::RRectF> { |
| 54 static SkRRect Convert(const mojo::RRectF& input); | 55 static SkRRect Convert(const mojo::RRectF& input); |
| 55 }; | 56 }; |
| 56 template <> | 57 template <> |
| 57 struct TypeConverter<mojo::RRectF, SkRRect> { | 58 struct TypeConverter<mojo::RRectF, SkRRect> { |
| 58 static mojo::RRectF Convert(const SkRRect& input); | 59 static mojo::RRectF Convert(const SkRRect& input); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 // Note: This transformation is lossy since Transform is 4x4 whereas | 62 // Note: This transformation is lossy since Transform is 4x4 whereas |
| 62 // SkMatrix is only 3x3. | 63 // SkMatrix is only 3x3 so we drop the 3rd row and column. |
| 63 template <> | 64 template <> |
| 64 struct TypeConverter<SkMatrix, mojo::TransformPtr> { | 65 struct TypeConverter<SkMatrix, mojo::TransformPtr> { |
| 65 static SkMatrix Convert(const mojo::TransformPtr& input); | 66 static SkMatrix Convert(const mojo::TransformPtr& input); |
| 66 }; | 67 }; |
| 67 template <> | 68 template <> |
| 68 struct TypeConverter<mojo::TransformPtr, SkMatrix> { | 69 struct TypeConverter<mojo::TransformPtr, SkMatrix> { |
| 69 static mojo::TransformPtr Convert(const SkMatrix& input); | 70 static mojo::TransformPtr Convert(const SkMatrix& input); |
| 70 }; | 71 }; |
| 71 | 72 |
| 73 // Note: This transformation is lossless. |
| 74 template <> |
| 75 struct TypeConverter<SkMatrix44, mojo::TransformPtr> { |
| 76 static SkMatrix44 Convert(const mojo::TransformPtr& input); |
| 77 }; |
| 78 template <> |
| 79 struct TypeConverter<mojo::TransformPtr, SkMatrix44> { |
| 80 static mojo::TransformPtr Convert(const SkMatrix44& input); |
| 81 }; |
| 82 |
| 72 } // namespace mojo | 83 } // namespace mojo |
| 73 | 84 |
| 74 #endif // MOJO_SKIA_TYPE_CONVERTERS_H_ | 85 #endif // MOJO_SKIA_TYPE_CONVERTERS_H_ |
| OLD | NEW |