gfx/layers/ipc/ShadowLayerUtils.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial