Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / gfx / ipc / gfx_param_traits.h
blob77aa120600fbb2a286ccab65b721fe1c2aedf9ab
1 // Copyright 2014 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.
5 #ifndef UI_GFX_IPC_GFX_PARAM_TRAITS_H_
6 #define UI_GFX_IPC_GFX_PARAM_TRAITS_H_
8 #include <string>
10 #include "ipc/ipc_message_utils.h"
11 #include "ipc/param_traits_macros.h"
12 #include "ui/gfx/buffer_types.h"
13 #include "ui/gfx/ipc/gfx_ipc_export.h"
14 #include "ui/gfx/ipc/gfx_param_traits_macros.h"
16 class SkBitmap;
18 namespace gfx {
19 class Point;
20 class PointF;
21 class Point3F;
22 class Range;
23 class Rect;
24 class RectF;
25 class Size;
26 class SizeF;
27 class Vector2d;
28 class Vector2dF;
29 } // namespace gfx
31 namespace IPC {
33 template <>
34 struct GFX_IPC_EXPORT ParamTraits<gfx::Point> {
35 typedef gfx::Point param_type;
36 static void Write(Message* m, const param_type& p);
37 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
38 static void Log(const param_type& p, std::string* l);
41 template <>
42 struct GFX_IPC_EXPORT ParamTraits<gfx::PointF> {
43 typedef gfx::PointF param_type;
44 static void Write(Message* m, const param_type& p);
45 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
46 static void Log(const param_type& p, std::string* l);
49 template <>
50 struct GFX_IPC_EXPORT ParamTraits<gfx::Point3F> {
51 typedef gfx::Point3F param_type;
52 static void Write(Message* m, const param_type& p);
53 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
54 static void Log(const param_type& p, std::string* l);
57 template <>
58 struct GFX_IPC_EXPORT ParamTraits<gfx::Size> {
59 typedef gfx::Size param_type;
60 static void Write(Message* m, const param_type& p);
61 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
62 static void Log(const param_type& p, std::string* l);
65 template <>
66 struct GFX_IPC_EXPORT ParamTraits<gfx::SizeF> {
67 typedef gfx::SizeF param_type;
68 static void Write(Message* m, const param_type& p);
69 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
70 static void Log(const param_type& p, std::string* l);
73 template <>
74 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2d> {
75 typedef gfx::Vector2d param_type;
76 static void Write(Message* m, const param_type& p);
77 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
78 static void Log(const param_type& p, std::string* l);
81 template <>
82 struct GFX_IPC_EXPORT ParamTraits<gfx::Vector2dF> {
83 typedef gfx::Vector2dF param_type;
84 static void Write(Message* m, const param_type& p);
85 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
86 static void Log(const param_type& p, std::string* l);
89 template <>
90 struct GFX_IPC_EXPORT ParamTraits<gfx::Rect> {
91 typedef gfx::Rect param_type;
92 static void Write(Message* m, const param_type& p);
93 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
94 static void Log(const param_type& p, std::string* l);
97 template <>
98 struct GFX_IPC_EXPORT ParamTraits<gfx::RectF> {
99 typedef gfx::RectF param_type;
100 static void Write(Message* m, const param_type& p);
101 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
102 static void Log(const param_type& p, std::string* l);
105 template <>
106 struct GFX_IPC_EXPORT ParamTraits<SkBitmap> {
107 typedef SkBitmap param_type;
108 static void Write(Message* m, const param_type& p);
110 // Note: This function expects parameter |r| to be of type &SkBitmap since
111 // r->SetConfig() and r->SetPixels() are called.
112 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
114 static void Log(const param_type& p, std::string* l);
117 template <>
118 struct GFX_IPC_EXPORT ParamTraits<gfx::Range> {
119 typedef gfx::Range param_type;
120 static void Write(Message* m, const param_type& p);
121 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
122 static void Log(const param_type& p, std::string* l);
125 } // namespace IPC
127 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_