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"
|
2012-05-31 18:30:08 -07:00
|
|
|
#include "GLContext.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; }
|
|
|
|
};
|
|
|
|
} }
|
|
|
|
#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<>
|
2012-11-26 12:51:57 -08:00
|
|
|
struct ParamTraits<mozilla::gl::GLContext::SharedTextureShareType>
|
2012-05-31 18:30:08 -07:00
|
|
|
{
|
2012-11-26 12:51:57 -08:00
|
|
|
typedef mozilla::gl::GLContext::SharedTextureShareType paramType;
|
2012-05-31 18:30:08 -07:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
2012-09-17 01:37:20 -07:00
|
|
|
MOZ_STATIC_ASSERT(sizeof(paramType) <= sizeof(int32_t),
|
|
|
|
"TextureShareType assumes to be int32_t");
|
|
|
|
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; }
|
|
|
|
};
|
|
|
|
#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>
|
|
|
|
: public EnumSerializer<mozilla::ScreenRotation,
|
|
|
|
mozilla::ROTATION_0,
|
|
|
|
mozilla::ROTATION_COUNT>
|
|
|
|
{};
|
|
|
|
|
|
|
|
} // namespace IPC
|
2010-09-03 13:10:45 -07:00
|
|
|
|
|
|
|
#endif // IPC_ShadowLayerUtils_h
|