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
|
|
|
|
|
|
|
|
#include "IPC/IPCMessageUtils.h"
|
|
|
|
#include "Layers.h"
|
|
|
|
|
2011-08-09 12:38:26 -07:00
|
|
|
#if defined(MOZ_ENABLE_D3D10_LAYER)
|
|
|
|
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
|
|
|
|
#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 {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::FrameMetrics>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::FrameMetrics paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2012-05-23 07:51:39 -07:00
|
|
|
WriteParam(aMsg, aParam.mCSSContentRect);
|
2011-01-13 09:45:14 -08:00
|
|
|
WriteParam(aMsg, aParam.mViewport);
|
2012-05-23 07:51:39 -07:00
|
|
|
WriteParam(aMsg, aParam.mContentRect);
|
2010-09-03 13:10:45 -07:00
|
|
|
WriteParam(aMsg, aParam.mViewportScrollOffset);
|
|
|
|
WriteParam(aMsg, aParam.mDisplayPort);
|
2011-01-13 09:45:14 -08:00
|
|
|
WriteParam(aMsg, aParam.mScrollId);
|
2012-04-24 19:48:33 -07:00
|
|
|
WriteParam(aMsg, aParam.mResolution);
|
2010-09-03 13:10:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2012-05-23 07:51:39 -07:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mCSSContentRect) &&
|
2012-04-12 12:55:26 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
2012-05-23 07:51:39 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mContentRect) &&
|
2010-09-03 13:10:45 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mViewportScrollOffset) &&
|
2011-01-13 09:45:14 -08:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
2012-04-24 19:48:33 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mResolution));
|
2010-09-03 13:10:45 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
#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
|
|
|
|
2010-09-03 13:10:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // IPC_ShadowLayerUtils_h
|