2010-09-03 13:10:45 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-03 13:10:45 -07:00
|
|
|
|
|
|
|
#ifndef IPC_ShadowLayerUtils_h
|
|
|
|
#define IPC_ShadowLayerUtils_h
|
|
|
|
|
2012-08-28 05:41:04 -07:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2013-09-04 05:14:52 -07:00
|
|
|
#include "GLContextTypes.h"
|
|
|
|
#include "SurfaceTypes.h"
|
2012-07-24 12:01:09 -07:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2010-09-03 13:10:45 -07:00
|
|
|
|
2011-08-09 12:38:26 -07:00
|
|
|
#if defined(MOZ_ENABLE_D3D10_LAYER)
|
|
|
|
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
|
|
|
|
#endif
|
|
|
|
|
2012-11-06 22:56:56 -08:00
|
|
|
#if defined(XP_MACOSX)
|
|
|
|
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
|
|
|
#endif
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
#if defined(MOZ_X11)
|
2011-08-09 12:38:26 -07:00
|
|
|
# include "mozilla/layers/ShadowLayerUtilsX11.h"
|
2010-09-13 22:23:08 -07:00
|
|
|
#else
|
|
|
|
namespace mozilla { namespace layers {
|
|
|
|
struct SurfaceDescriptorX11 {
|
|
|
|
bool operator==(const SurfaceDescriptorX11&) const { return false; }
|
|
|
|
};
|
|
|
|
} }
|
|
|
|
#endif
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
#if defined(MOZ_WIDGET_GONK)
|
|
|
|
# include "mozilla/layers/ShadowLayerUtilsGralloc.h"
|
|
|
|
#else
|
|
|
|
namespace mozilla { namespace layers {
|
|
|
|
struct MagicGrallocBufferHandle {
|
|
|
|
bool operator==(const MagicGrallocBufferHandle&) const { return false; }
|
|
|
|
};
|
2014-04-30 18:52:00 -07:00
|
|
|
|
|
|
|
struct GrallocBufferRef {
|
|
|
|
bool operator==(const GrallocBufferRef&) const { return false; }
|
|
|
|
};
|
2012-07-12 05:51:58 -07:00
|
|
|
} }
|
|
|
|
#endif
|
|
|
|
|
2010-09-03 13:10:45 -07:00
|
|
|
namespace IPC {
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
#if !defined(MOZ_HAVE_SURFACEDESCRIPTORX11)
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
|
|
|
|
typedef mozilla::layers::SurfaceDescriptorX11 paramType;
|
|
|
|
static void Write(Message*, const paramType&) {}
|
|
|
|
static bool Read(const Message*, void**, paramType*) { return false; }
|
|
|
|
};
|
2012-07-12 05:51:58 -07:00
|
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORX11)
|
|
|
|
|
2012-05-31 18:30:08 -07:00
|
|
|
template<>
|
2013-09-04 05:14:52 -07:00
|
|
|
struct ParamTraits<mozilla::gl::SharedTextureShareType>
|
2012-05-31 18:30:08 -07:00
|
|
|
{
|
2013-09-04 05:14:52 -07:00
|
|
|
typedef mozilla::gl::SharedTextureShareType paramType;
|
2012-05-31 18:30:08 -07:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
2013-07-18 10:59:53 -07:00
|
|
|
static_assert(sizeof(paramType) <= sizeof(int32_t),
|
|
|
|
"TextureShareType assumes to be int32_t");
|
2012-09-17 01:37:20 -07:00
|
|
|
WriteParam(msg, int32_t(param));
|
2012-05-31 18:30:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
2012-09-17 01:37:20 -07:00
|
|
|
int32_t type;
|
2012-05-31 18:30:08 -07:00
|
|
|
if (!ReadParam(msg, iter, &type))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*result = paramType(type);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
#if !defined(MOZ_HAVE_SURFACEDESCRIPTORGRALLOC)
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> {
|
|
|
|
typedef mozilla::layers::MagicGrallocBufferHandle paramType;
|
|
|
|
static void Write(Message*, const paramType&) {}
|
|
|
|
static bool Read(const Message*, void**, paramType*) { return false; }
|
|
|
|
};
|
2014-04-30 18:52:00 -07:00
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::GrallocBufferRef> {
|
|
|
|
typedef mozilla::layers::GrallocBufferRef paramType;
|
|
|
|
static void Write(Message*, const paramType&) {}
|
|
|
|
static bool Read(const Message*, void**, paramType*) { return false; }
|
|
|
|
};
|
2012-07-12 05:51:58 -07:00
|
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
|
2010-09-13 22:23:08 -07:00
|
|
|
|
2012-07-24 12:01:09 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::ScreenRotation>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::ScreenRotation,
|
|
|
|
mozilla::ROTATION_0,
|
|
|
|
mozilla::ROTATION_COUNT>
|
2012-07-24 12:01:09 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
} // namespace IPC
|
2010-09-03 13:10:45 -07:00
|
|
|
|
|
|
|
#endif // IPC_ShadowLayerUtils_h
|