gfx/layers/ipc/ShadowLayerUtils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/ipc/ShadowLayerUtils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef IPC_ShadowLayerUtils_h
    1.12 +#define IPC_ShadowLayerUtils_h
    1.13 +
    1.14 +#include "ipc/IPCMessageUtils.h"
    1.15 +#include "GLContextTypes.h"
    1.16 +#include "SurfaceTypes.h"
    1.17 +#include "mozilla/WidgetUtils.h"
    1.18 +
    1.19 +#if defined(MOZ_ENABLE_D3D10_LAYER)
    1.20 +# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
    1.21 +#endif
    1.22 +
    1.23 +#if defined(XP_MACOSX)
    1.24 +#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
    1.25 +#endif
    1.26 +
    1.27 +#if defined(MOZ_X11)
    1.28 +# include "mozilla/layers/ShadowLayerUtilsX11.h"
    1.29 +#else
    1.30 +namespace mozilla { namespace layers {
    1.31 +struct SurfaceDescriptorX11 {
    1.32 +  bool operator==(const SurfaceDescriptorX11&) const { return false; }
    1.33 +};
    1.34 +} }
    1.35 +#endif
    1.36 +
    1.37 +#if defined(MOZ_WIDGET_GONK)
    1.38 +# include "mozilla/layers/ShadowLayerUtilsGralloc.h"
    1.39 +#else
    1.40 +namespace mozilla { namespace layers {
    1.41 +struct MagicGrallocBufferHandle {
    1.42 +  bool operator==(const MagicGrallocBufferHandle&) const { return false; }
    1.43 +};
    1.44 +} }
    1.45 +#endif
    1.46 +
    1.47 +namespace IPC {
    1.48 +
    1.49 +#if !defined(MOZ_HAVE_SURFACEDESCRIPTORX11)
    1.50 +template <>
    1.51 +struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
    1.52 +  typedef mozilla::layers::SurfaceDescriptorX11 paramType;
    1.53 +  static void Write(Message*, const paramType&) {}
    1.54 +  static bool Read(const Message*, void**, paramType*) { return false; }
    1.55 +};
    1.56 +#endif  // !defined(MOZ_HAVE_XSURFACEDESCRIPTORX11)
    1.57 +
    1.58 +template<>
    1.59 +struct ParamTraits<mozilla::gl::SharedTextureShareType>
    1.60 +{
    1.61 +  typedef mozilla::gl::SharedTextureShareType paramType;
    1.62 +
    1.63 +  static void Write(Message* msg, const paramType& param)
    1.64 +  {
    1.65 +    static_assert(sizeof(paramType) <= sizeof(int32_t),
    1.66 +                  "TextureShareType assumes to be int32_t");
    1.67 +    WriteParam(msg, int32_t(param));
    1.68 +  }
    1.69 +
    1.70 +  static bool Read(const Message* msg, void** iter, paramType* result)
    1.71 +  {
    1.72 +    int32_t type;
    1.73 +    if (!ReadParam(msg, iter, &type))
    1.74 +      return false;
    1.75 +
    1.76 +    *result = paramType(type);
    1.77 +    return true;
    1.78 +  }
    1.79 +};
    1.80 +
    1.81 +#if !defined(MOZ_HAVE_SURFACEDESCRIPTORGRALLOC)
    1.82 +template <>
    1.83 +struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> {
    1.84 +  typedef mozilla::layers::MagicGrallocBufferHandle paramType;
    1.85 +  static void Write(Message*, const paramType&) {}
    1.86 +  static bool Read(const Message*, void**, paramType*) { return false; }
    1.87 +};
    1.88 +#endif  // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
    1.89 +
    1.90 +template <>
    1.91 +struct ParamTraits<mozilla::ScreenRotation>
    1.92 +  : public ContiguousEnumSerializer<
    1.93 +             mozilla::ScreenRotation,
    1.94 +             mozilla::ROTATION_0,
    1.95 +             mozilla::ROTATION_COUNT>
    1.96 +{};
    1.97 +
    1.98 +} // namespace IPC
    1.99 +
   1.100 +#endif // IPC_ShadowLayerUtils_h

mercurial