2013-07-26 12:28:31 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef __GFXMESSAGEUTILS_H__
|
|
|
|
#define __GFXMESSAGEUTILS_H__
|
|
|
|
|
|
|
|
#include "base/process_util.h"
|
|
|
|
#include "chrome/common/ipc_message_utils.h"
|
2013-08-11 16:15:10 -07:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "gfxColor.h"
|
2013-12-26 10:06:53 -08:00
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2013-10-01 14:01:19 -07:00
|
|
|
#include "GraphicsFilter.h"
|
2013-07-26 12:28:31 -07:00
|
|
|
#include "gfxPoint.h"
|
|
|
|
#include "gfxRect.h"
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsRegion.h"
|
2013-09-24 13:45:14 -07:00
|
|
|
#include "gfxTypes.h"
|
2013-07-26 12:28:31 -07:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
|
|
|
#include "FrameMetrics.h"
|
2014-03-19 19:12:42 -07:00
|
|
|
#include "FilterSupport.h"
|
2014-04-15 10:39:20 -07:00
|
|
|
#include "mozilla/layers/GeckoContentController.h"
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning( disable : 4800 )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-09-24 13:45:13 -07:00
|
|
|
typedef gfxImageFormat PixelFormat;
|
2013-10-01 14:01:19 -07:00
|
|
|
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
|
|
|
typedef ::GraphicsFilter GraphicsFilterType;
|
|
|
|
#else
|
|
|
|
// If we don't have support for enum classes, then we need to use the actual
|
|
|
|
// enum type here instead of the simulated enum class.
|
|
|
|
typedef GraphicsFilter::Enum GraphicsFilterType;
|
|
|
|
#endif
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template<>
|
2013-12-26 10:06:53 -08:00
|
|
|
struct ParamTraits<mozilla::gfx::Matrix>
|
2013-07-26 12:28:31 -07:00
|
|
|
{
|
2013-12-26 10:06:53 -08:00
|
|
|
typedef mozilla::gfx::Matrix paramType;
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2013-12-26 10:06:53 -08:00
|
|
|
WriteParam(aMsg, aParam._11);
|
|
|
|
WriteParam(aMsg, aParam._12);
|
|
|
|
WriteParam(aMsg, aParam._21);
|
|
|
|
WriteParam(aMsg, aParam._22);
|
|
|
|
WriteParam(aMsg, aParam._31);
|
|
|
|
WriteParam(aMsg, aParam._32);
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2013-12-26 10:06:53 -08:00
|
|
|
if (ReadParam(aMsg, aIter, &aResult->_11) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->_12) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->_21) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->_22) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->_31) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->_32))
|
2013-07-26 12:28:31 -07:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
2013-12-26 10:06:53 -08:00
|
|
|
aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam._11, aParam._12, aParam._21, aParam._22,
|
|
|
|
aParam._31, aParam._32));
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-27 07:28:33 -08:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Matrix4x4>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Matrix4x4 paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
#define Wr(_f) WriteParam(msg, param. _f)
|
|
|
|
Wr(_11); Wr(_12); Wr(_13); Wr(_14);
|
|
|
|
Wr(_21); Wr(_22); Wr(_23); Wr(_24);
|
|
|
|
Wr(_31); Wr(_32); Wr(_33); Wr(_34);
|
|
|
|
Wr(_41); Wr(_42); Wr(_43); Wr(_44);
|
|
|
|
#undef Wr
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
#define Rd(_f) ReadParam(msg, iter, &result-> _f)
|
|
|
|
return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
|
|
|
|
Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
|
|
|
|
Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
|
|
|
|
Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44));
|
|
|
|
#undef Rd
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:42 -07:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Matrix5x4>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Matrix5x4 paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
#define Wr(_f) WriteParam(msg, param. _f)
|
|
|
|
Wr(_11); Wr(_12); Wr(_13); Wr(_14);
|
|
|
|
Wr(_21); Wr(_22); Wr(_23); Wr(_24);
|
|
|
|
Wr(_31); Wr(_32); Wr(_33); Wr(_34);
|
|
|
|
Wr(_41); Wr(_42); Wr(_43); Wr(_44);
|
|
|
|
Wr(_51); Wr(_52); Wr(_53); Wr(_54);
|
|
|
|
#undef Wr
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
#define Rd(_f) ReadParam(msg, iter, &result-> _f)
|
|
|
|
return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
|
|
|
|
Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
|
|
|
|
Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
|
|
|
|
Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44) &&
|
|
|
|
Rd(_51) && Rd(_52) && Rd(_53) && Rd(_54));
|
|
|
|
#undef Rd
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 12:28:31 -07:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxPoint>
|
|
|
|
{
|
|
|
|
typedef gfxPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxSize>
|
|
|
|
{
|
|
|
|
typedef gfxSize paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.width);
|
|
|
|
WriteParam(aMsg, aParam.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
if (ReadParam(aMsg, aIter, &aResult->width) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->height))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxRect>
|
|
|
|
{
|
|
|
|
typedef gfxRect paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
WriteParam(aMsg, aParam.width);
|
|
|
|
WriteParam(aMsg, aParam.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->width) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->height);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
2013-09-24 13:45:14 -07:00
|
|
|
struct ParamTraits<gfxContentType>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
gfxContentType,
|
|
|
|
gfxContentType::COLOR,
|
|
|
|
gfxContentType::SENTINEL>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
2013-09-24 13:45:14 -07:00
|
|
|
struct ParamTraits<gfxSurfaceType>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
gfxSurfaceType,
|
|
|
|
gfxSurfaceType::Image,
|
|
|
|
gfxSurfaceType::Max>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::GraphicsFilterType>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::GraphicsFilterType,
|
|
|
|
GraphicsFilter::FILTER_FAST,
|
|
|
|
GraphicsFilter::FILTER_SENTINEL>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::LayersBackend>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::layers::LayersBackend,
|
|
|
|
mozilla::layers::LayersBackend::LAYERS_NONE,
|
|
|
|
mozilla::layers::LayersBackend::LAYERS_LAST>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
2013-08-20 12:45:30 -07:00
|
|
|
struct ParamTraits<mozilla::layers::ScaleMode>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::layers::ScaleMode,
|
|
|
|
mozilla::layers::ScaleMode::SCALE_NONE,
|
|
|
|
mozilla::layers::ScaleMode::SENTINEL>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
2014-01-23 10:26:40 -08:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<gfxImageFormat>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
gfxImageFormat,
|
|
|
|
gfxImageFormat::ARGB32,
|
|
|
|
gfxImageFormat::Unknown>
|
2014-01-23 10:26:40 -08:00
|
|
|
{};
|
|
|
|
|
2014-03-19 19:12:44 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeName>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::AttributeName,
|
|
|
|
mozilla::gfx::eBlendBlendmode,
|
|
|
|
mozilla::gfx::eLastAttributeName>
|
2014-03-19 19:12:44 -07:00
|
|
|
{};
|
|
|
|
|
2014-03-19 19:12:42 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeType>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::gfx::AttributeType,
|
|
|
|
mozilla::gfx::AttributeType::eBool,
|
|
|
|
mozilla::gfx::AttributeType::Max>
|
2014-03-19 19:12:42 -07:00
|
|
|
{};
|
|
|
|
|
2014-03-19 19:12:43 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::PrimitiveType>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::gfx::PrimitiveType,
|
|
|
|
mozilla::gfx::PrimitiveType::Empty,
|
|
|
|
mozilla::gfx::PrimitiveType::Max>
|
2014-03-19 19:12:43 -07:00
|
|
|
{};
|
|
|
|
|
2014-03-19 19:12:43 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorSpace>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::gfx::ColorSpace,
|
|
|
|
mozilla::gfx::ColorSpace::SRGB,
|
|
|
|
mozilla::gfx::ColorSpace::Max>
|
2014-03-19 19:12:43 -07:00
|
|
|
{};
|
|
|
|
|
2014-04-25 19:34:05 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureFlags>
|
|
|
|
: public BitFlagsTypedEnumSerializer<
|
|
|
|
mozilla::layers::TextureFlags,
|
|
|
|
mozilla::layers::TextureFlags::ALL_BITS>
|
|
|
|
{};
|
|
|
|
|
2014-04-25 19:34:06 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureIdentifier>
|
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::layers::TextureIdentifier,
|
|
|
|
mozilla::layers::TextureIdentifier::Front,
|
|
|
|
mozilla::layers::TextureIdentifier::HighBound>
|
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::DeprecatedTextureHostFlags>
|
|
|
|
: public BitFlagsTypedEnumSerializer<
|
|
|
|
mozilla::layers::DeprecatedTextureHostFlags,
|
|
|
|
mozilla::layers::DeprecatedTextureHostFlags::ALL_BITS>
|
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::DiagnosticTypes>
|
|
|
|
: public BitFlagsTypedEnumSerializer<
|
|
|
|
mozilla::layers::DiagnosticTypes,
|
|
|
|
mozilla::layers::DiagnosticTypes::ALL_BITS>
|
|
|
|
{};
|
|
|
|
|
2014-01-23 10:26:40 -08:00
|
|
|
/*
|
2013-07-26 12:28:31 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::PixelFormat>
|
|
|
|
: public EnumSerializer<mozilla::PixelFormat,
|
2014-01-23 10:26:40 -08:00
|
|
|
gfxImageFormat::ARGB32,
|
|
|
|
gfxImageFormat::Unknown>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
2014-01-23 10:26:40 -08:00
|
|
|
*/
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxRGBA>
|
|
|
|
{
|
|
|
|
typedef gfxRGBA paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.r);
|
|
|
|
WriteParam(msg, param.g);
|
|
|
|
WriteParam(msg, param.b);
|
|
|
|
WriteParam(msg, param.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->r) &&
|
|
|
|
ReadParam(msg, iter, &result->g) &&
|
|
|
|
ReadParam(msg, iter, &result->b) &&
|
|
|
|
ReadParam(msg, iter, &result->a));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:41 -07:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Color>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Color paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.r);
|
|
|
|
WriteParam(msg, param.g);
|
|
|
|
WriteParam(msg, param.b);
|
|
|
|
WriteParam(msg, param.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->r) &&
|
|
|
|
ReadParam(msg, iter, &result->g) &&
|
|
|
|
ReadParam(msg, iter, &result->b) &&
|
|
|
|
ReadParam(msg, iter, &result->a));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 12:28:31 -07:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsPoint>
|
|
|
|
{
|
|
|
|
typedef nsPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntPoint>
|
|
|
|
{
|
|
|
|
typedef nsIntPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-11-17 20:56:18 -08:00
|
|
|
template<typename T>
|
|
|
|
struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
|
2013-07-26 12:28:31 -07:00
|
|
|
{
|
2014-11-17 20:56:18 -08:00
|
|
|
typedef mozilla::gfx::IntSizeTyped<T> paramType;
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntRect>
|
|
|
|
{
|
|
|
|
typedef nsIntRect paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename Region, typename Rect, typename Iter>
|
|
|
|
struct RegionParamTraits
|
|
|
|
{
|
|
|
|
typedef Region paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
Iter it(param);
|
2014-07-18 19:30:08 -07:00
|
|
|
while (const Rect* r = it.Next()) {
|
|
|
|
MOZ_ASSERT(!r->IsEmpty());
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(msg, *r);
|
2014-07-18 19:30:08 -07:00
|
|
|
}
|
2013-07-26 12:28:31 -07:00
|
|
|
// empty rects are sentinel values because nsRegions will never
|
|
|
|
// contain them
|
|
|
|
WriteParam(msg, Rect());
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
Rect rect;
|
|
|
|
while (ReadParam(msg, iter, &rect)) {
|
|
|
|
if (rect.IsEmpty())
|
|
|
|
return true;
|
|
|
|
result->Or(*result, rect);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntRegion>
|
|
|
|
: RegionParamTraits<nsIntRegion, nsIntRect, nsIntRegionRectIterator>
|
|
|
|
{};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntSize>
|
|
|
|
{
|
|
|
|
typedef nsIntSize paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-19 10:08:16 -07:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::CoordTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::CoordTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->value));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::IntCoordTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::IntCoordTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->value));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 12:28:31 -07:00
|
|
|
template<class T, class U>
|
|
|
|
struct ParamTraits< mozilla::gfx::ScaleFactor<T, U> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::ScaleFactor<T, U> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->scale));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::PointTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::PointTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:42 -07:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::Point3DTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Point3DTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.z);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->z));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 12:28:31 -07:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::IntPointTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::IntPointTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-26 16:24:25 -07:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::SizeTyped<T> >
|
2013-07-26 12:28:31 -07:00
|
|
|
{
|
2014-03-26 16:24:25 -07:00
|
|
|
typedef mozilla::gfx::SizeTyped<T> paramType;
|
2013-07-26 12:28:31 -07:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::RectTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::RectTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::IntRectTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::IntRectTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Margin>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Margin paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.top);
|
|
|
|
WriteParam(msg, param.right);
|
|
|
|
WriteParam(msg, param.bottom);
|
|
|
|
WriteParam(msg, param.left);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->top) &&
|
|
|
|
ReadParam(msg, iter, &result->right) &&
|
|
|
|
ReadParam(msg, iter, &result->bottom) &&
|
|
|
|
ReadParam(msg, iter, &result->left));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::MarginTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::MarginTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.top);
|
|
|
|
WriteParam(msg, param.right);
|
|
|
|
WriteParam(msg, param.bottom);
|
|
|
|
WriteParam(msg, param.left);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->top) &&
|
|
|
|
ReadParam(msg, iter, &result->right) &&
|
|
|
|
ReadParam(msg, iter, &result->bottom) &&
|
|
|
|
ReadParam(msg, iter, &result->left));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsRect>
|
|
|
|
{
|
|
|
|
typedef nsRect paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsRegion>
|
|
|
|
: RegionParamTraits<nsRegion, nsRect, nsRegionRectIterator>
|
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::FrameMetrics>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::FrameMetrics paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mScrollableRect);
|
|
|
|
WriteParam(aMsg, aParam.mViewport);
|
|
|
|
WriteParam(aMsg, aParam.mScrollOffset);
|
|
|
|
WriteParam(aMsg, aParam.mDisplayPort);
|
2014-03-26 18:46:24 -07:00
|
|
|
WriteParam(aMsg, aParam.mDisplayPortMargins);
|
|
|
|
WriteParam(aMsg, aParam.mUseDisplayPortMargins);
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(aMsg, aParam.mCriticalDisplayPort);
|
|
|
|
WriteParam(aMsg, aParam.mCompositionBounds);
|
2014-03-26 16:24:25 -07:00
|
|
|
WriteParam(aMsg, aParam.mRootCompositionSize);
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(aMsg, aParam.mScrollId);
|
2014-08-27 19:13:39 -07:00
|
|
|
WriteParam(aMsg, aParam.mScrollParentId);
|
2014-10-20 14:12:35 -07:00
|
|
|
WriteParam(aMsg, aParam.mPresShellResolution);
|
2013-09-05 15:26:59 -07:00
|
|
|
WriteParam(aMsg, aParam.mCumulativeResolution);
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(aMsg, aParam.mZoom);
|
|
|
|
WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
|
|
|
|
WriteParam(aMsg, aParam.mMayHaveTouchListeners);
|
2014-06-03 00:08:54 -07:00
|
|
|
WriteParam(aMsg, aParam.mMayHaveTouchCaret);
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(aMsg, aParam.mPresShellId);
|
2013-11-08 16:07:00 -08:00
|
|
|
WriteParam(aMsg, aParam.mIsRoot);
|
2013-09-23 12:09:48 -07:00
|
|
|
WriteParam(aMsg, aParam.mHasScrollgrab);
|
2014-02-10 07:26:44 -08:00
|
|
|
WriteParam(aMsg, aParam.mUpdateScrollOffset);
|
|
|
|
WriteParam(aMsg, aParam.mScrollGeneration);
|
2014-10-24 12:49:38 -07:00
|
|
|
WriteParam(aMsg, aParam.mExtraResolution);
|
2014-08-29 05:23:25 -07:00
|
|
|
WriteParam(aMsg, aParam.mBackgroundColor);
|
2014-07-10 11:52:40 -07:00
|
|
|
WriteParam(aMsg, aParam.mDoSmoothScroll);
|
|
|
|
WriteParam(aMsg, aParam.mSmoothScrollOffset);
|
2014-11-17 20:56:18 -08:00
|
|
|
WriteParam(aMsg, aParam.GetLineScrollAmount());
|
2014-08-29 05:23:25 -07:00
|
|
|
WriteParam(aMsg, aParam.GetContentDescription());
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool ReadContentDescription(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
nsCString str;
|
|
|
|
if (!ReadParam(aMsg, aIter, &str)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->SetContentDescription(str);
|
|
|
|
return true;
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2014-07-31 13:11:47 -07:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mScrollableRect) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mUseDisplayPortMargins) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
2014-08-27 19:13:39 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollParentId) &&
|
2014-10-20 14:12:35 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mPresShellResolution) &&
|
2014-07-31 13:11:47 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mZoom) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mIsRoot) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollGeneration) &&
|
2014-10-24 12:49:38 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mExtraResolution) &&
|
2014-08-29 05:23:25 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
|
2014-07-10 11:52:40 -07:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mDoSmoothScroll) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSmoothScrollOffset) &&
|
2014-11-17 20:56:18 -08:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mLineScrollAmount) &&
|
2014-08-29 05:23:25 -07:00
|
|
|
ReadContentDescription(aMsg, aIter, aResult));
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::TextureFactoryIdentifier paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mParentBackend);
|
2014-05-09 02:48:32 -07:00
|
|
|
WriteParam(aMsg, aParam.mSupportedBlendModes.serialize());
|
2013-07-26 12:28:31 -07:00
|
|
|
WriteParam(aMsg, aParam.mMaxTextureSize);
|
|
|
|
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
|
|
|
|
WriteParam(aMsg, aParam.mSupportsPartialUploads);
|
2014-12-12 17:50:47 -08:00
|
|
|
WriteParam(aMsg, aParam.mSyncHandle);
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2014-05-09 02:48:32 -07:00
|
|
|
uint32_t supportedBlendModes = 0;
|
|
|
|
bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
|
|
|
ReadParam(aMsg, aIter, &supportedBlendModes) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
2014-12-12 17:50:47 -08:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSyncHandle);
|
2014-05-09 02:48:32 -07:00
|
|
|
aResult->mSupportedBlendModes.deserialize(supportedBlendModes);
|
|
|
|
return result;
|
2013-07-26 12:28:31 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureInfo>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::TextureInfo paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mCompositableType);
|
|
|
|
WriteParam(aMsg, aParam.mDeprecatedTextureHostFlags);
|
|
|
|
WriteParam(aMsg, aParam.mTextureFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mCompositableType) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mDeprecatedTextureHostFlags) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mTextureFlags);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::CompositableType>
|
2014-04-25 19:34:06 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
2014-04-14 07:17:40 -07:00
|
|
|
mozilla::layers::CompositableType,
|
2014-11-25 17:00:34 -08:00
|
|
|
mozilla::layers::CompositableType::UNKNOWN,
|
|
|
|
mozilla::layers::CompositableType::COUNT>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::SurfaceFormat>
|
2014-04-14 07:17:40 -07:00
|
|
|
: public ContiguousTypedEnumSerializer<
|
|
|
|
mozilla::gfx::SurfaceFormat,
|
|
|
|
mozilla::gfx::SurfaceFormat::B8G8R8A8,
|
|
|
|
mozilla::gfx::SurfaceFormat::UNKNOWN>
|
2013-07-26 12:28:31 -07:00
|
|
|
{};
|
|
|
|
|
2013-11-13 10:20:31 -08:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::ScrollableLayerGuid>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::ScrollableLayerGuid paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mLayersId);
|
|
|
|
WriteParam(aMsg, aParam.mPresShellId);
|
|
|
|
WriteParam(aMsg, aParam.mScrollId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mLayersId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollId));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-06 10:26:44 -08:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::ZoomConstraints>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::ZoomConstraints paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mAllowZoom);
|
2014-02-24 16:22:45 -08:00
|
|
|
WriteParam(aMsg, aParam.mAllowDoubleTapZoom);
|
2014-01-06 10:26:44 -08:00
|
|
|
WriteParam(aMsg, aParam.mMinZoom);
|
|
|
|
WriteParam(aMsg, aParam.mMaxZoom);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mAllowZoom) &&
|
2014-02-24 16:22:45 -08:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mAllowDoubleTapZoom) &&
|
2014-01-06 10:26:44 -08:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mMinZoom) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mMaxZoom));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-12-16 02:47:06 -08:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::EventRegions>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::EventRegions paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mHitRegion);
|
|
|
|
WriteParam(aMsg, aParam.mDispatchToContentHitRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mHitRegion) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mDispatchToContentHitRegion));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:45 -07:00
|
|
|
struct MessageAndAttributeMap
|
|
|
|
{
|
|
|
|
Message* msg;
|
|
|
|
const mozilla::gfx::AttributeMap& map;
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool
|
|
|
|
WriteAttribute(mozilla::gfx::AttributeName aName,
|
|
|
|
mozilla::gfx::AttributeType aType,
|
|
|
|
void* aUserData)
|
|
|
|
{
|
|
|
|
MessageAndAttributeMap* msgAndMap =
|
|
|
|
static_cast<MessageAndAttributeMap*>(aUserData);
|
|
|
|
|
|
|
|
WriteParam(msgAndMap->msg, aType);
|
|
|
|
WriteParam(msgAndMap->msg, aName);
|
|
|
|
|
|
|
|
switch (aType) {
|
|
|
|
|
|
|
|
#define HANDLE_TYPE(typeName) \
|
|
|
|
case mozilla::gfx::AttributeType::e##typeName: \
|
|
|
|
WriteParam(msgAndMap->msg, msgAndMap->map.Get##typeName(aName)); \
|
|
|
|
break;
|
|
|
|
|
|
|
|
HANDLE_TYPE(Bool)
|
|
|
|
HANDLE_TYPE(Uint)
|
|
|
|
HANDLE_TYPE(Float)
|
|
|
|
HANDLE_TYPE(Size)
|
|
|
|
HANDLE_TYPE(IntSize)
|
|
|
|
HANDLE_TYPE(IntPoint)
|
|
|
|
HANDLE_TYPE(Matrix)
|
|
|
|
HANDLE_TYPE(Matrix5x4)
|
|
|
|
HANDLE_TYPE(Point3D)
|
|
|
|
HANDLE_TYPE(Color)
|
|
|
|
HANDLE_TYPE(AttributeMap)
|
|
|
|
HANDLE_TYPE(Floats)
|
|
|
|
|
|
|
|
#undef HANDLE_TYPE
|
|
|
|
|
|
|
|
default:
|
|
|
|
MOZ_CRASH("unhandled attribute type");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeMap>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::AttributeMap paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.Count());
|
|
|
|
MessageAndAttributeMap msgAndMap = { aMsg, aParam };
|
|
|
|
aParam.EnumerateRead(WriteAttribute, &msgAndMap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
uint32_t count;
|
|
|
|
if (!ReadParam(aMsg, aIter, &count)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
|
|
mozilla::gfx::AttributeType type;
|
|
|
|
if (!ReadParam(aMsg, aIter, &type)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mozilla::gfx::AttributeName name;
|
|
|
|
if (!ReadParam(aMsg, aIter, &name)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
#define HANDLE_TYPE(type, typeName) \
|
|
|
|
case mozilla::gfx::AttributeType::e##typeName: \
|
|
|
|
{ \
|
|
|
|
type value; \
|
|
|
|
if (!ReadParam(aMsg, aIter, &value)) { \
|
|
|
|
return false; \
|
|
|
|
} \
|
|
|
|
aResult->Set(name, value); \
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE_TYPE(bool, Bool)
|
|
|
|
HANDLE_TYPE(uint32_t, Uint)
|
|
|
|
HANDLE_TYPE(float, Float)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::Size, Size)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::IntSize, IntSize)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::IntPoint, IntPoint)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::Matrix, Matrix)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::Matrix5x4, Matrix5x4)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::Point3D, Point3D)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::Color, Color)
|
|
|
|
HANDLE_TYPE(mozilla::gfx::AttributeMap, AttributeMap)
|
|
|
|
|
|
|
|
#undef HANDLE_TYPE
|
|
|
|
|
|
|
|
case mozilla::gfx::AttributeType::eFloats:
|
|
|
|
{
|
|
|
|
nsTArray<float> value;
|
|
|
|
if (!ReadParam(aMsg, aIter, &value)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->Set(name, &value[0], value.Length());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
MOZ_CRASH("unhandled attribute type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:45 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::FilterPrimitiveDescription>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::FilterPrimitiveDescription paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.Type());
|
|
|
|
WriteParam(aMsg, aParam.PrimitiveSubregion());
|
2014-07-29 09:48:16 -07:00
|
|
|
WriteParam(aMsg, aParam.FilterSpaceBounds());
|
2014-03-19 19:12:45 -07:00
|
|
|
WriteParam(aMsg, aParam.IsTainted());
|
|
|
|
WriteParam(aMsg, aParam.OutputColorSpace());
|
|
|
|
WriteParam(aMsg, aParam.NumberOfInputs());
|
|
|
|
for (size_t i = 0; i < aParam.NumberOfInputs(); i++) {
|
|
|
|
WriteParam(aMsg, aParam.InputPrimitiveIndex(i));
|
|
|
|
WriteParam(aMsg, aParam.InputColorSpace(i));
|
|
|
|
}
|
|
|
|
WriteParam(aMsg, aParam.Attributes());
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
mozilla::gfx::PrimitiveType type;
|
|
|
|
mozilla::gfx::IntRect primitiveSubregion;
|
2014-07-29 09:48:16 -07:00
|
|
|
mozilla::gfx::IntRect filterSpaceBounds;
|
2014-03-19 19:12:45 -07:00
|
|
|
bool isTainted = false;
|
|
|
|
mozilla::gfx::ColorSpace outputColorSpace;
|
|
|
|
size_t numberOfInputs = 0;
|
|
|
|
if (!ReadParam(aMsg, aIter, &type) ||
|
|
|
|
!ReadParam(aMsg, aIter, &primitiveSubregion) ||
|
2014-07-29 09:48:16 -07:00
|
|
|
!ReadParam(aMsg, aIter, &filterSpaceBounds) ||
|
2014-03-19 19:12:45 -07:00
|
|
|
!ReadParam(aMsg, aIter, &isTainted) ||
|
|
|
|
!ReadParam(aMsg, aIter, &outputColorSpace) ||
|
|
|
|
!ReadParam(aMsg, aIter, &numberOfInputs)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
aResult->SetType(type);
|
|
|
|
aResult->SetPrimitiveSubregion(primitiveSubregion);
|
2014-07-29 09:48:16 -07:00
|
|
|
aResult->SetFilterSpaceBounds(filterSpaceBounds);
|
2014-03-19 19:12:45 -07:00
|
|
|
aResult->SetIsTainted(isTainted);
|
|
|
|
aResult->SetOutputColorSpace(outputColorSpace);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < numberOfInputs; i++) {
|
|
|
|
int32_t inputPrimitiveIndex = 0;
|
|
|
|
mozilla::gfx::ColorSpace inputColorSpace;
|
|
|
|
if (!ReadParam(aMsg, aIter, &inputPrimitiveIndex) ||
|
|
|
|
!ReadParam(aMsg, aIter, &inputColorSpace)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aResult->SetInputPrimitive(i, inputPrimitiveIndex);
|
|
|
|
aResult->SetInputColorSpace(i, inputColorSpace);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->Attributes());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-19 19:12:45 -07:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::FilterDescription>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::FilterDescription paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mPrimitives);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2014-07-29 09:48:16 -07:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mPrimitives));
|
2014-03-19 19:12:45 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-15 10:39:20 -07:00
|
|
|
typedef mozilla::layers::GeckoContentController::APZStateChange APZStateChange;
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<APZStateChange>
|
2014-09-12 08:39:32 -07:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-15 10:39:20 -07:00
|
|
|
APZStateChange,
|
|
|
|
APZStateChange::TransformBegin,
|
|
|
|
APZStateChange::APZStateChangeSentinel>
|
|
|
|
{};
|
|
|
|
|
2013-07-26 12:28:31 -07:00
|
|
|
} /* namespace IPC */
|
|
|
|
|
|
|
|
#endif /* __GFXMESSAGEUTILS_H__ */
|