2013-07-26 23:28:31 +04: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__
|
|
|
|
|
2016-03-23 20:46:20 +03:00
|
|
|
#include "FilterSupport.h"
|
|
|
|
#include "FrameMetrics.h"
|
|
|
|
#include "ImageTypes.h"
|
|
|
|
#include "RegionBuilder.h"
|
2013-07-26 23:28:31 +04:00
|
|
|
#include "base/process_util.h"
|
|
|
|
#include "chrome/common/ipc_message_utils.h"
|
2017-06-24 00:23:12 +03:00
|
|
|
#include "gfxFeature.h"
|
2017-07-11 10:13:26 +03:00
|
|
|
#include "gfxFallback.h"
|
2013-07-26 23:28:31 +04:00
|
|
|
#include "gfxPoint.h"
|
|
|
|
#include "gfxRect.h"
|
2016-08-21 06:59:10 +03:00
|
|
|
#include "gfxTelemetry.h"
|
2013-09-25 00:45:14 +04:00
|
|
|
#include "gfxTypes.h"
|
2016-03-23 20:46:20 +03:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
|
|
|
#include "mozilla/gfx/Matrix.h"
|
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsRegion.h"
|
2016-11-24 08:11:30 +03:00
|
|
|
#include "mozilla/Array.h"
|
2016-03-23 20:46:20 +03:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning( disable : 4800 )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-09-25 00:45:13 +04:00
|
|
|
typedef gfxImageFormat PixelFormat;
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template<>
|
2013-12-26 22:06:53 +04:00
|
|
|
struct ParamTraits<mozilla::gfx::Matrix>
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2013-12-26 22:06:53 +04:00
|
|
|
typedef mozilla::gfx::Matrix paramType;
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2013-12-26 22:06:53 +04: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 23:28:31 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2013-12-26 22:06:53 +04: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 23:28:31 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
2013-12-26 22:06:53 +04: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 23:28:31 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-27 19:28:33 +04: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
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-01-27 19:28:33 +04:00
|
|
|
{
|
|
|
|
#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-20 06:12:42 +04: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
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-03-20 06:12:42 +04:00
|
|
|
{
|
|
|
|
#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 23:28:31 +04:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxPoint>
|
|
|
|
{
|
|
|
|
typedef gfxPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->width) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->height);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
2013-09-25 00:45:14 +04:00
|
|
|
struct ParamTraits<gfxContentType>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
gfxContentType,
|
|
|
|
gfxContentType::COLOR,
|
|
|
|
gfxContentType::SENTINEL>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
2013-09-25 00:45:14 +04:00
|
|
|
struct ParamTraits<gfxSurfaceType>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
gfxSurfaceType,
|
|
|
|
gfxSurfaceType::Image,
|
|
|
|
gfxSurfaceType::Max>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
|
|
|
template <>
|
2016-05-25 19:01:18 +03:00
|
|
|
struct ParamTraits<mozilla::gfx::SamplingFilter>
|
2014-04-14 18:17:40 +04:00
|
|
|
: public ContiguousEnumSerializer<
|
2016-05-25 19:01:18 +03:00
|
|
|
mozilla::gfx::SamplingFilter,
|
|
|
|
mozilla::gfx::SamplingFilter::GOOD,
|
|
|
|
mozilla::gfx::SamplingFilter::SENTINEL>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
2016-08-04 21:33:44 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::BackendType>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::BackendType,
|
|
|
|
mozilla::gfx::BackendType::NONE,
|
|
|
|
mozilla::gfx::BackendType::BACKEND_LAST>
|
|
|
|
{};
|
|
|
|
|
2017-06-24 00:23:12 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::Feature>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::Feature,
|
|
|
|
mozilla::gfx::Feature::HW_COMPOSITING,
|
|
|
|
mozilla::gfx::Feature::NumValues>
|
|
|
|
{};
|
|
|
|
|
2017-07-11 10:13:26 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::Fallback>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::Fallback,
|
|
|
|
mozilla::gfx::Fallback::NO_CONSTANT_BUFFER_OFFSETTING,
|
|
|
|
mozilla::gfx::Fallback::NumValues>
|
|
|
|
{};
|
|
|
|
|
2016-08-21 06:59:10 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::FeatureStatus>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::FeatureStatus,
|
|
|
|
mozilla::gfx::FeatureStatus::Unused,
|
|
|
|
mozilla::gfx::FeatureStatus::LAST>
|
|
|
|
{};
|
|
|
|
|
2014-03-20 06:12:44 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeName>
|
2014-04-14 18:17:40 +04:00
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::gfx::AttributeName,
|
|
|
|
mozilla::gfx::eBlendBlendmode,
|
|
|
|
mozilla::gfx::eLastAttributeName>
|
2014-03-20 06:12:44 +04:00
|
|
|
{};
|
|
|
|
|
2014-03-20 06:12:42 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeType>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::AttributeType,
|
|
|
|
mozilla::gfx::AttributeType::eBool,
|
|
|
|
mozilla::gfx::AttributeType::Max>
|
2014-03-20 06:12:42 +04:00
|
|
|
{};
|
|
|
|
|
2014-03-20 06:12:43 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::PrimitiveType>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::PrimitiveType,
|
|
|
|
mozilla::gfx::PrimitiveType::Empty,
|
|
|
|
mozilla::gfx::PrimitiveType::Max>
|
2014-03-20 06:12:43 +04:00
|
|
|
{};
|
|
|
|
|
2014-03-20 06:12:43 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorSpace>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::ColorSpace,
|
|
|
|
mozilla::gfx::ColorSpace::SRGB,
|
|
|
|
mozilla::gfx::ColorSpace::Max>
|
2014-03-20 06:12:43 +04:00
|
|
|
{};
|
|
|
|
|
2014-01-23 22:26:40 +04:00
|
|
|
/*
|
2013-07-26 23:28:31 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::PixelFormat>
|
|
|
|
: public EnumSerializer<mozilla::PixelFormat,
|
2016-01-08 07:57:38 +03:00
|
|
|
SurfaceFormat::A8R8G8B8_UINT32,
|
|
|
|
SurfaceFormat::UNKNOWN>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
2014-01-23 22:26:40 +04:00
|
|
|
*/
|
2013-07-26 23:28:31 +04:00
|
|
|
|
2014-03-20 06:12:41 +04: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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-03-20 06:12:41 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->r) &&
|
|
|
|
ReadParam(msg, iter, &result->g) &&
|
|
|
|
ReadParam(msg, iter, &result->b) &&
|
|
|
|
ReadParam(msg, iter, &result->a));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsPoint>
|
|
|
|
{
|
|
|
|
typedef nsPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-11-18 07:56:18 +03:00
|
|
|
template<typename T>
|
|
|
|
struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2014-11-18 07:56:18 +03:00
|
|
|
typedef mozilla::gfx::IntSizeTyped<T> paramType;
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (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)
|
|
|
|
{
|
2016-03-23 20:46:20 +03:00
|
|
|
|
2016-01-19 04:20:58 +03:00
|
|
|
for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) {
|
|
|
|
const Rect& r = iter.Get();
|
2016-06-06 18:17:23 +03:00
|
|
|
MOZ_RELEASE_ASSERT(!r.IsEmpty(), "GFX: rect is empty.");
|
2016-01-19 04:20:58 +03:00
|
|
|
WriteParam(msg, r);
|
2014-07-19 06:30:08 +04:00
|
|
|
}
|
2013-07-26 23:28:31 +04:00
|
|
|
// empty rects are sentinel values because nsRegions will never
|
|
|
|
// contain them
|
|
|
|
WriteParam(msg, Rect());
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2016-03-23 20:46:20 +03:00
|
|
|
RegionBuilder<Region> builder;
|
2013-07-26 23:28:31 +04:00
|
|
|
Rect rect;
|
|
|
|
while (ReadParam(msg, iter, &rect)) {
|
2016-03-23 20:46:20 +03:00
|
|
|
if (rect.IsEmpty()) {
|
|
|
|
*result = builder.ToRegion();
|
2013-07-26 23:28:31 +04:00
|
|
|
return true;
|
2016-03-23 20:46:20 +03:00
|
|
|
}
|
2016-05-21 07:06:51 +03:00
|
|
|
builder.OrWith(rect);
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
2016-03-23 20:46:20 +03:00
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-11-29 10:07:55 +03:00
|
|
|
template<class Units>
|
|
|
|
struct ParamTraits<mozilla::gfx::IntRegionTyped<Units>>
|
|
|
|
: RegionParamTraits<mozilla::gfx::IntRegionTyped<Units>,
|
|
|
|
mozilla::gfx::IntRectTyped<Units>,
|
2016-01-19 04:20:58 +03:00
|
|
|
typename mozilla::gfx::IntRegionTyped<Units>::RectIterator>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
|
|
|
template<>
|
2015-05-29 15:39:19 +03:00
|
|
|
struct ParamTraits<mozilla::gfx::IntSize>
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2015-05-29 15:39:19 +03:00
|
|
|
typedef mozilla::gfx::IntSize paramType;
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-08-19 21:08:16 +04: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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-08-19 21:08:16 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-08-19 21:08:16 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->value));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 23:28:31 +04: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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->scale));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-06 21:53:47 +03:00
|
|
|
template<class T, class U>
|
|
|
|
struct ParamTraits< mozilla::gfx::ScaleFactors2D<T, U> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::ScaleFactors2D<T, U> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.xScale);
|
|
|
|
WriteParam(msg, param.yScale);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2015-03-06 21:53:47 +03:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->xScale) &&
|
|
|
|
ReadParam(msg, iter, &result->yScale));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-06-11 23:43:40 +03:00
|
|
|
template<class F, class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::Point3DTyped<F, T> >
|
2014-03-20 06:12:42 +04:00
|
|
|
{
|
2015-06-11 23:43:40 +03:00
|
|
|
typedef mozilla::gfx::Point3DTyped<F, T> paramType;
|
2014-03-20 06:12:42 +04:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.z);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2014-03-20 06:12:42 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->z));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 23:28:31 +04: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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-27 03:24:25 +04:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::SizeTyped<T> >
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
2014-03-27 03:24:25 +04:00
|
|
|
typedef mozilla::gfx::SizeTyped<T> paramType;
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
|
2013-07-26 23:28:31 +04:00
|
|
|
{
|
|
|
|
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>
|
2016-01-19 04:20:58 +03:00
|
|
|
: RegionParamTraits<nsRegion, nsRect, nsRegion::RectIterator>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
2016-11-02 23:57:15 +03:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<GeckoProcessType>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
GeckoProcessType,
|
|
|
|
GeckoProcessType_Default,
|
|
|
|
GeckoProcessType_End>
|
|
|
|
{};
|
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::SurfaceFormat>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::SurfaceFormat,
|
|
|
|
mozilla::gfx::SurfaceFormat::B8G8R8A8,
|
|
|
|
mozilla::gfx::SurfaceFormat::UNKNOWN>
|
2013-07-26 23:28:31 +04:00
|
|
|
{};
|
|
|
|
|
2015-12-16 21:50:58 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::StereoMode>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::StereoMode,
|
|
|
|
mozilla::StereoMode::MONO,
|
2016-04-25 20:09:59 +03:00
|
|
|
mozilla::StereoMode::MAX>
|
2015-12-16 21:50:58 +03:00
|
|
|
{};
|
|
|
|
|
2016-10-12 05:46:28 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::YUVColorSpace>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::YUVColorSpace,
|
|
|
|
mozilla::YUVColorSpace::BT601,
|
|
|
|
mozilla::YUVColorSpace::UNKNOWN>
|
|
|
|
{};
|
|
|
|
|
2014-03-20 06:12:45 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::AttributeMap>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::AttributeMap paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.Count());
|
2015-09-29 17:49:41 +03:00
|
|
|
for (auto iter = aParam.ConstIter(); !iter.Done(); iter.Next()) {
|
|
|
|
mozilla::gfx::AttributeName name =
|
|
|
|
mozilla::gfx::AttributeName(iter.Key());
|
|
|
|
mozilla::gfx::AttributeType type =
|
|
|
|
mozilla::gfx::AttributeMap::GetType(iter.UserData());
|
|
|
|
|
|
|
|
WriteParam(aMsg, type);
|
|
|
|
WriteParam(aMsg, name);
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
#define CASE_TYPE(typeName) \
|
|
|
|
case mozilla::gfx::AttributeType::e##typeName: \
|
|
|
|
WriteParam(aMsg, aParam.Get##typeName(name)); \
|
|
|
|
break;
|
|
|
|
|
|
|
|
CASE_TYPE(Bool)
|
|
|
|
CASE_TYPE(Uint)
|
|
|
|
CASE_TYPE(Float)
|
|
|
|
CASE_TYPE(Size)
|
|
|
|
CASE_TYPE(IntSize)
|
|
|
|
CASE_TYPE(IntPoint)
|
|
|
|
CASE_TYPE(Matrix)
|
|
|
|
CASE_TYPE(Matrix5x4)
|
|
|
|
CASE_TYPE(Point3D)
|
|
|
|
CASE_TYPE(Color)
|
|
|
|
CASE_TYPE(AttributeMap)
|
|
|
|
CASE_TYPE(Floats)
|
|
|
|
|
|
|
|
#undef CASE_TYPE
|
|
|
|
|
|
|
|
default:
|
2016-05-13 23:34:41 +03:00
|
|
|
MOZ_CRASH("GFX: unhandled attribute type");
|
2015-09-29 17:49:41 +03:00
|
|
|
}
|
|
|
|
}
|
2014-03-20 06:12:45 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2014-03-20 06:12:45 +04:00
|
|
|
{
|
|
|
|
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); \
|
2015-10-18 08:53:03 +03:00
|
|
|
break; \
|
2014-03-20 06:12:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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:
|
2016-05-13 23:34:41 +03:00
|
|
|
MOZ_CRASH("GFX: unhandled attribute type");
|
2014-03-20 06:12:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-20 06:12:45 +04: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 20:48:16 +04:00
|
|
|
WriteParam(aMsg, aParam.FilterSpaceBounds());
|
2014-03-20 06:12:45 +04: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());
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2014-03-20 06:12:45 +04:00
|
|
|
{
|
|
|
|
mozilla::gfx::PrimitiveType type;
|
|
|
|
mozilla::gfx::IntRect primitiveSubregion;
|
2014-07-29 20:48:16 +04:00
|
|
|
mozilla::gfx::IntRect filterSpaceBounds;
|
2014-03-20 06:12:45 +04:00
|
|
|
bool isTainted = false;
|
|
|
|
mozilla::gfx::ColorSpace outputColorSpace;
|
|
|
|
size_t numberOfInputs = 0;
|
|
|
|
if (!ReadParam(aMsg, aIter, &type) ||
|
|
|
|
!ReadParam(aMsg, aIter, &primitiveSubregion) ||
|
2014-07-29 20:48:16 +04:00
|
|
|
!ReadParam(aMsg, aIter, &filterSpaceBounds) ||
|
2014-03-20 06:12:45 +04:00
|
|
|
!ReadParam(aMsg, aIter, &isTainted) ||
|
|
|
|
!ReadParam(aMsg, aIter, &outputColorSpace) ||
|
|
|
|
!ReadParam(aMsg, aIter, &numberOfInputs)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
aResult->SetType(type);
|
|
|
|
aResult->SetPrimitiveSubregion(primitiveSubregion);
|
2014-07-29 20:48:16 +04:00
|
|
|
aResult->SetFilterSpaceBounds(filterSpaceBounds);
|
2014-03-20 06:12:45 +04: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-20 06:12:45 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::FilterDescription>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::FilterDescription paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mPrimitives);
|
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
2014-03-20 06:12:45 +04:00
|
|
|
{
|
2014-07-29 20:48:16 +04:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mPrimitives));
|
2014-03-20 06:12:45 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-11-24 08:11:29 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::Glyph>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Glyph paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mIndex);
|
|
|
|
WriteParam(aMsg, aParam.mPosition);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mIndex) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mPosition)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-11-24 08:11:30 +03:00
|
|
|
template<typename T, size_t Length>
|
|
|
|
struct ParamTraits<mozilla::Array<T, Length>>
|
|
|
|
{
|
|
|
|
typedef mozilla::Array<T, Length> paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
for (size_t i = 0; i < Length; i++) {
|
|
|
|
WriteParam(aMsg, aParam[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
|
|
|
for (size_t i = 0; i < Length; i++) {
|
2017-03-03 14:46:00 +03:00
|
|
|
if (!ReadParam<T>(aMsg, aIter, &aResult->operator[](i))) {
|
2016-11-24 08:11:30 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-06-24 00:23:12 +03:00
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
} /* namespace IPC */
|
|
|
|
|
|
|
|
#endif /* __GFXMESSAGEUTILS_H__ */
|