Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: mojo/skia/type_converters.h

Issue 1534033002: Improve Ganesh helpers. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-8
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/skia/gl_bindings_skia.cc ('k') | mojo/skia/type_converters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/skia/type_converters.h
diff --git a/mojo/skia/type_converters.h b/mojo/skia/type_converters.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f18878b68f2c2f4bf2acfae5cff0591754d7faa
--- /dev/null
+++ b/mojo/skia/type_converters.h
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SKIA_TYPE_CONVERTERS_H_
+#define MOJO_SKIA_TYPE_CONVERTERS_H_
+
+#include "mojo/services/geometry/interfaces/geometry.mojom.h"
+#include "third_party/skia/include/core/SkMatrix.h"
+#include "third_party/skia/include/core/SkPoint.h"
+#include "third_party/skia/include/core/SkRRect.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+namespace mojo {
+
+template <>
+struct TypeConverter<SkPoint, mojo::Point> {
+ static SkPoint Convert(const mojo::Point& input);
+};
+template <>
+struct TypeConverter<mojo::Point, SkPoint> {
+ static mojo::Point Convert(const SkPoint& input);
+};
+
+template <>
+struct TypeConverter<SkRect, mojo::Rect> {
+ static SkRect Convert(const mojo::Rect& input);
+};
+template <>
+struct TypeConverter<mojo::Rect, SkRect> {
+ static mojo::Rect Convert(const SkRect& input);
+};
+
+template <>
+struct TypeConverter<SkRRect, mojo::RRect> {
+ static SkRRect Convert(const mojo::RRect& input);
+};
+template <>
+struct TypeConverter<mojo::RRect, SkRRect> {
+ static mojo::RRect Convert(const SkRRect& input);
+};
+
+// Note: This transformation is lossy since Transform is 4x4 whereas
+// SkMatrix is only 3x3.
+template <>
+struct TypeConverter<SkMatrix, mojo::TransformPtr> {
+ static SkMatrix Convert(const mojo::TransformPtr& input);
+};
+template <>
+struct TypeConverter<mojo::TransformPtr, SkMatrix> {
+ static mojo::TransformPtr Convert(const SkMatrix& input);
+};
+
+} // namespace mojo
+
+#endif // MOJO_SKIA_TYPE_CONVERTERS_H_
« no previous file with comments | « mojo/skia/gl_bindings_skia.cc ('k') | mojo/skia/type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698