2010-09-03 20:10:45 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00: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 20:10:45 +00:00
|
|
|
|
|
|
|
#ifndef IPC_ShadowLayerUtils_h
|
|
|
|
#define IPC_ShadowLayerUtils_h
|
|
|
|
|
2012-08-28 12:41:04 +00:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2013-09-04 12:14:52 +00:00
|
|
|
#include "GLContextTypes.h"
|
|
|
|
#include "SurfaceTypes.h"
|
2012-07-24 19:01:09 +00:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2010-09-03 20:10:45 +00:00
|
|
|
|
2011-08-09 19:38:26 +00:00
|
|
|
#if defined(MOZ_ENABLE_D3D10_LAYER)
|
|
|
|
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
|
|
|
|
#endif
|
|
|
|
|
2012-11-07 06:56:56 +00:00
|
|
|
#if defined(XP_MACOSX)
|
|
|
|
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
|
|
|
#endif
|
|
|
|
|
2010-09-14 05:23:08 +00:00
|
|
|
#if defined(MOZ_X11)
|
2011-08-09 19:38:26 +00:00
|
|
|
# include "mozilla/layers/ShadowLayerUtilsX11.h"
|
2010-09-14 05:23:08 +00:00
|
|
|
#else
|
|
|
|
namespace mozilla { namespace layers {
|
|
|
|
struct SurfaceDescriptorX11 {
|
|
|
|
bool operator==(const SurfaceDescriptorX11&) const { return false; }
|
|
|
|
};
|
|
|
|
} }
|
|
|
|
#endif
|
|
|
|
|
2012-07-12 12:51:58 +00: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-05-01 01:52:00 +00:00
|
|
|
|
|
|
|
struct GrallocBufferRef {
|
|
|
|
bool operator==(const GrallocBufferRef&) const { return false; }
|
|
|
|
};
|
2012-07-12 12:51:58 +00:00
|
|
|
} }
|
|
|
|
#endif
|
|
|
|
|
2010-09-03 20:10:45 +00:00
|
|
|
namespace IPC {
|
|
|
|
|
2010-09-14 05:23:08 +00: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 12:51:58 +00:00
|
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORX11)
|
|
|
|
|
2012-06-01 01:30:08 +00:00
|
|
|
template<>
|
2013-09-04 12:14:52 +00:00
|
|
|
struct ParamTraits<mozilla::gl::SharedTextureShareType>
|
2012-06-01 01:30:08 +00:00
|
|
|
{
|
2013-09-04 12:14:52 +00:00
|
|
|
typedef mozilla::gl::SharedTextureShareType paramType;
|
2012-06-01 01:30:08 +00:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
2013-07-18 17:59:53 +00:00
|
|
|
static_assert(sizeof(paramType) <= sizeof(int32_t),
|
|
|
|
"TextureShareType assumes to be int32_t");
|
2012-09-17 08:37:20 +00:00
|
|
|
WriteParam(msg, int32_t(param));
|
2012-06-01 01:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
2012-09-17 08:37:20 +00:00
|
|
|
int32_t type;
|
2012-06-01 01:30:08 +00:00
|
|
|
if (!ReadParam(msg, iter, &type))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*result = paramType(type);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-12 12:51:58 +00: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-05-01 01:52:00 +00: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 12:51:58 +00:00
|
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
|
2010-09-14 05:23:08 +00:00
|
|
|
|
2012-07-24 19:01:09 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::ScreenRotation>
|
2014-04-14 14:17:40 +00:00
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::ScreenRotation,
|
|
|
|
mozilla::ROTATION_0,
|
|
|
|
mozilla::ROTATION_COUNT>
|
2012-07-24 19:01:09 +00:00
|
|
|
{};
|
|
|
|
|
|
|
|
} // namespace IPC
|
2010-09-03 20:10:45 +00:00
|
|
|
|
|
|
|
#endif // IPC_ShadowLayerUtils_h
|