OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SKIA_TYPE_CONVERTERS_H_ |
| 6 #define MOJO_SKIA_TYPE_CONVERTERS_H_ |
| 7 |
| 8 #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
| 9 #include "third_party/skia/include/core/SkMatrix.h" |
| 10 #include "third_party/skia/include/core/SkPoint.h" |
| 11 #include "third_party/skia/include/core/SkRRect.h" |
| 12 #include "third_party/skia/include/core/SkRect.h" |
| 13 |
| 14 namespace mojo { |
| 15 |
| 16 template <> |
| 17 struct TypeConverter<SkPoint, mojo::Point> { |
| 18 static SkPoint Convert(const mojo::Point& input); |
| 19 }; |
| 20 template <> |
| 21 struct TypeConverter<mojo::Point, SkPoint> { |
| 22 static mojo::Point Convert(const SkPoint& input); |
| 23 }; |
| 24 |
| 25 template <> |
| 26 struct TypeConverter<SkRect, mojo::Rect> { |
| 27 static SkRect Convert(const mojo::Rect& input); |
| 28 }; |
| 29 template <> |
| 30 struct TypeConverter<mojo::Rect, SkRect> { |
| 31 static mojo::Rect Convert(const SkRect& input); |
| 32 }; |
| 33 |
| 34 template <> |
| 35 struct TypeConverter<SkRRect, mojo::RRect> { |
| 36 static SkRRect Convert(const mojo::RRect& input); |
| 37 }; |
| 38 template <> |
| 39 struct TypeConverter<mojo::RRect, SkRRect> { |
| 40 static mojo::RRect Convert(const SkRRect& input); |
| 41 }; |
| 42 |
| 43 // Note: This transformation is lossy since Transform is 4x4 whereas |
| 44 // SkMatrix is only 3x3. |
| 45 template <> |
| 46 struct TypeConverter<SkMatrix, mojo::TransformPtr> { |
| 47 static SkMatrix Convert(const mojo::TransformPtr& input); |
| 48 }; |
| 49 template <> |
| 50 struct TypeConverter<mojo::TransformPtr, SkMatrix> { |
| 51 static mojo::TransformPtr Convert(const SkMatrix& input); |
| 52 }; |
| 53 |
| 54 } // namespace mojo |
| 55 |
| 56 #endif // MOJO_SKIA_TYPE_CONVERTERS_H_ |
OLD | NEW |