| 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 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 | 15 |
| 16 template <> | 16 template <> |
| 17 struct TypeConverter<SkPoint, mojo::Point> { | 17 struct TypeConverter<SkIPoint, mojo::Point> { |
| 18 static SkPoint Convert(const mojo::Point& input); | 18 static SkIPoint Convert(const mojo::Point& input); |
| 19 }; | 19 }; |
| 20 template <> | 20 template <> |
| 21 struct TypeConverter<mojo::Point, SkPoint> { | 21 struct TypeConverter<mojo::Point, SkIPoint> { |
| 22 static mojo::Point Convert(const SkPoint& input); | 22 static mojo::Point Convert(const SkIPoint& input); |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 template <> | 25 template <> |
| 26 struct TypeConverter<SkRect, mojo::Rect> { | 26 struct TypeConverter<SkPoint, mojo::PointF> { |
| 27 static SkRect Convert(const mojo::Rect& input); | 27 static SkPoint Convert(const mojo::PointF& input); |
| 28 }; | 28 }; |
| 29 template <> | 29 template <> |
| 30 struct TypeConverter<mojo::Rect, SkRect> { | 30 struct TypeConverter<mojo::PointF, SkPoint> { |
| 31 static mojo::Rect Convert(const SkRect& input); | 31 static mojo::PointF Convert(const SkPoint& input); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 template <> | 34 template <> |
| 35 struct TypeConverter<SkRRect, mojo::RRect> { | 35 struct TypeConverter<SkIRect, mojo::Rect> { |
| 36 static SkRRect Convert(const mojo::RRect& input); | 36 static SkIRect Convert(const mojo::Rect& input); |
| 37 }; | 37 }; |
| 38 template <> | 38 template <> |
| 39 struct TypeConverter<mojo::RRect, SkRRect> { | 39 struct TypeConverter<mojo::Rect, SkIRect> { |
| 40 static mojo::RRect Convert(const SkRRect& input); | 40 static mojo::Rect Convert(const SkIRect& input); |
| 41 }; |
| 42 |
| 43 template <> |
| 44 struct TypeConverter<SkRect, mojo::RectF> { |
| 45 static SkRect Convert(const mojo::RectF& input); |
| 46 }; |
| 47 template <> |
| 48 struct TypeConverter<mojo::RectF, SkRect> { |
| 49 static mojo::RectF Convert(const SkRect& input); |
| 50 }; |
| 51 |
| 52 template <> |
| 53 struct TypeConverter<SkRRect, mojo::RRectF> { |
| 54 static SkRRect Convert(const mojo::RRectF& input); |
| 55 }; |
| 56 template <> |
| 57 struct TypeConverter<mojo::RRectF, SkRRect> { |
| 58 static mojo::RRectF Convert(const SkRRect& input); |
| 41 }; | 59 }; |
| 42 | 60 |
| 43 // Note: This transformation is lossy since Transform is 4x4 whereas | 61 // Note: This transformation is lossy since Transform is 4x4 whereas |
| 44 // SkMatrix is only 3x3. | 62 // SkMatrix is only 3x3. |
| 45 template <> | 63 template <> |
| 46 struct TypeConverter<SkMatrix, mojo::TransformPtr> { | 64 struct TypeConverter<SkMatrix, mojo::TransformPtr> { |
| 47 static SkMatrix Convert(const mojo::TransformPtr& input); | 65 static SkMatrix Convert(const mojo::TransformPtr& input); |
| 48 }; | 66 }; |
| 49 template <> | 67 template <> |
| 50 struct TypeConverter<mojo::TransformPtr, SkMatrix> { | 68 struct TypeConverter<mojo::TransformPtr, SkMatrix> { |
| 51 static mojo::TransformPtr Convert(const SkMatrix& input); | 69 static mojo::TransformPtr Convert(const SkMatrix& input); |
| 52 }; | 70 }; |
| 53 | 71 |
| 54 } // namespace mojo | 72 } // namespace mojo |
| 55 | 73 |
| 56 #endif // MOJO_SKIA_TYPE_CONVERTERS_H_ | 74 #endif // MOJO_SKIA_TYPE_CONVERTERS_H_ |
| OLD | NEW |