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.

     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/. */
     8 #ifndef IPC_ShadowLayerUtils_h
     9 #define IPC_ShadowLayerUtils_h
    11 #include "ipc/IPCMessageUtils.h"
    12 #include "GLContextTypes.h"
    13 #include "SurfaceTypes.h"
    14 #include "mozilla/WidgetUtils.h"
    16 #if defined(MOZ_ENABLE_D3D10_LAYER)
    17 # include "mozilla/layers/ShadowLayerUtilsD3D10.h"
    18 #endif
    20 #if defined(XP_MACOSX)
    21 #define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
    22 #endif
    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
    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
    44 namespace IPC {
    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)
    55 template<>
    56 struct ParamTraits<mozilla::gl::SharedTextureShareType>
    57 {
    58   typedef mozilla::gl::SharedTextureShareType paramType;
    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   }
    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;
    73     *result = paramType(type);
    74     return true;
    75   }
    76 };
    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)
    87 template <>
    88 struct ParamTraits<mozilla::ScreenRotation>
    89   : public ContiguousEnumSerializer<
    90              mozilla::ScreenRotation,
    91              mozilla::ROTATION_0,
    92              mozilla::ROTATION_COUNT>
    93 {};
    95 } // namespace IPC
    97 #endif // IPC_ShadowLayerUtils_h

mercurial