gfx/layers/ipc/ShadowLayerUtils.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:811ca58ef9b8
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: sw=2 ts=8 et :
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #ifndef IPC_ShadowLayerUtils_h
9 #define IPC_ShadowLayerUtils_h
10
11 #include "ipc/IPCMessageUtils.h"
12 #include "GLContextTypes.h"
13 #include "SurfaceTypes.h"
14 #include "mozilla/WidgetUtils.h"
15
16 #if defined(MOZ_ENABLE_D3D10_LAYER)
17 # include "mozilla/layers/ShadowLayerUtilsD3D10.h"
18 #endif
19
20 #if defined(XP_MACOSX)
21 #define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
22 #endif
23
24 #if defined(MOZ_X11)
25 # include "mozilla/layers/ShadowLayerUtilsX11.h"
26 #else
27 namespace mozilla { namespace layers {
28 struct SurfaceDescriptorX11 {
29 bool operator==(const SurfaceDescriptorX11&) const { return false; }
30 };
31 } }
32 #endif
33
34 #if defined(MOZ_WIDGET_GONK)
35 # include "mozilla/layers/ShadowLayerUtilsGralloc.h"
36 #else
37 namespace mozilla { namespace layers {
38 struct MagicGrallocBufferHandle {
39 bool operator==(const MagicGrallocBufferHandle&) const { return false; }
40 };
41 } }
42 #endif
43
44 namespace IPC {
45
46 #if !defined(MOZ_HAVE_SURFACEDESCRIPTORX11)
47 template <>
48 struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
49 typedef mozilla::layers::SurfaceDescriptorX11 paramType;
50 static void Write(Message*, const paramType&) {}
51 static bool Read(const Message*, void**, paramType*) { return false; }
52 };
53 #endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORX11)
54
55 template<>
56 struct ParamTraits<mozilla::gl::SharedTextureShareType>
57 {
58 typedef mozilla::gl::SharedTextureShareType paramType;
59
60 static void Write(Message* msg, const paramType& param)
61 {
62 static_assert(sizeof(paramType) <= sizeof(int32_t),
63 "TextureShareType assumes to be int32_t");
64 WriteParam(msg, int32_t(param));
65 }
66
67 static bool Read(const Message* msg, void** iter, paramType* result)
68 {
69 int32_t type;
70 if (!ReadParam(msg, iter, &type))
71 return false;
72
73 *result = paramType(type);
74 return true;
75 }
76 };
77
78 #if !defined(MOZ_HAVE_SURFACEDESCRIPTORGRALLOC)
79 template <>
80 struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> {
81 typedef mozilla::layers::MagicGrallocBufferHandle paramType;
82 static void Write(Message*, const paramType&) {}
83 static bool Read(const Message*, void**, paramType*) { return false; }
84 };
85 #endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
86
87 template <>
88 struct ParamTraits<mozilla::ScreenRotation>
89 : public ContiguousEnumSerializer<
90 mozilla::ScreenRotation,
91 mozilla::ROTATION_0,
92 mozilla::ROTATION_COUNT>
93 {};
94
95 } // namespace IPC
96
97 #endif // IPC_ShadowLayerUtils_h

mercurial