2013-07-26 23:28:31 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2017-10-28 02:10:06 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-07-26 23:28:31 +04: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/. */
|
|
|
|
|
|
|
|
#ifndef __GFXMESSAGEUTILS_H__
|
|
|
|
#define __GFXMESSAGEUTILS_H__
|
|
|
|
|
2016-03-23 20:46:20 +03:00
|
|
|
#include "FilterSupport.h"
|
|
|
|
#include "ImageTypes.h"
|
|
|
|
#include "RegionBuilder.h"
|
2013-07-26 23:28:31 +04:00
|
|
|
#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"
|
2020-12-10 14:09:21 +03:00
|
|
|
#include "ipc/EnumSerializer.h"
|
|
|
|
#include "ipc/IPCMessageUtilsSpecializations.h"
|
2018-09-25 05:48:02 +03:00
|
|
|
#include "mozilla/gfx/CrossProcessPaint.h"
|
2016-03-23 20:46:20 +03:00
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2020-11-23 19:21:38 +03:00
|
|
|
#include "mozilla/gfx/ScaleFactor.h"
|
|
|
|
#include "mozilla/gfx/ScaleFactors2D.h"
|
2016-03-23 20:46:20 +03:00
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsRegion.h"
|
2016-11-24 08:11:30 +03:00
|
|
|
#include "mozilla/Array.h"
|
2020-11-23 19:21:38 +03:00
|
|
|
#include "mozilla/ipc/IPDLParamTraits.h"
|
2019-11-28 10:29:33 +03:00
|
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
2020-11-23 19:05:02 +03:00
|
|
|
#include "mozilla/ipc/ShmemMessageUtils.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
|
|
|
|
2018-09-19 20:18:16 +03:00
|
|
|
} // namespace mozilla
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template <>
|
2013-12-26 22:06:53 +04:00
|
|
|
struct ParamTraits<mozilla::gfx::Matrix> {
|
|
|
|
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-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) {
|
2017-12-19 23:48:39 +03:00
|
|
|
WriteParam(aMsg, aParam.X());
|
|
|
|
WriteParam(aMsg, aParam.Y());
|
|
|
|
WriteParam(aMsg, aParam.Width());
|
|
|
|
WriteParam(aMsg, aParam.Height());
|
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) {
|
2017-12-19 23:48:39 +03:00
|
|
|
auto x = aResult->X();
|
|
|
|
auto y = aResult->Y();
|
|
|
|
auto w = aResult->Width();
|
|
|
|
auto h = aResult->Height();
|
|
|
|
|
|
|
|
bool retVal = (ReadParam(aMsg, aIter, &x) && ReadParam(aMsg, aIter, &y) &&
|
|
|
|
ReadParam(aMsg, aIter, &w) && ReadParam(aMsg, aIter, &h));
|
|
|
|
aResult->SetRect(x, y, w, h);
|
|
|
|
return retVal;
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
2013-09-25 00:45:14 +04:00
|
|
|
struct ParamTraits<gfxContentType>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<gfxContentType, gfxContentType::COLOR,
|
2014-04-14 18:17:40 +04:00
|
|
|
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<gfxSurfaceType, gfxSurfaceType::Image,
|
2014-04-14 18:17:40 +04:00
|
|
|
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<mozilla::gfx::SamplingFilter,
|
2016-05-25 19:01:18 +03:00
|
|
|
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> {};
|
|
|
|
|
2018-09-19 20:18:16 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::LightType>
|
|
|
|
: public ContiguousEnumSerializer<mozilla::gfx::LightType,
|
|
|
|
mozilla::gfx::LightType::None,
|
|
|
|
mozilla::gfx::LightType::Max> {};
|
|
|
|
|
2014-03-20 06:12:43 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorSpace>
|
2015-01-26 01:22:08 +03:00
|
|
|
: public ContiguousEnumSerializer<mozilla::gfx::ColorSpace,
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::ColorSpace::SRGB,
|
|
|
|
mozilla::gfx::ColorSpace::Max> {};
|
2014-03-20 06:12:43 +04:00
|
|
|
|
2020-03-13 22:59:04 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::CompositionOp>
|
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::gfx::CompositionOp, mozilla::gfx::CompositionOp::OP_OVER,
|
|
|
|
mozilla::gfx::CompositionOp::OP_COUNT> {};
|
|
|
|
|
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 <>
|
2020-03-09 17:16:17 +03:00
|
|
|
struct ParamTraits<mozilla::gfx::sRGBColor> {
|
|
|
|
typedef mozilla::gfx::sRGBColor 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, PickleIterator* iter,
|
|
|
|
paramType* result) {
|
|
|
|
return (
|
|
|
|
ReadParam(msg, iter, &result->r) && ReadParam(msg, iter, &result->g) &&
|
|
|
|
ReadParam(msg, iter, &result->b) && ReadParam(msg, iter, &result->a));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::DeviceColor> {
|
|
|
|
typedef mozilla::gfx::DeviceColor paramType;
|
2014-03-20 06:12:41 +04:00
|
|
|
|
|
|
|
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>> {
|
|
|
|
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-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) {
|
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> {
|
|
|
|
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>> {
|
|
|
|
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>> {
|
|
|
|
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) {
|
2017-12-19 23:48:39 +03:00
|
|
|
WriteParam(msg, param.X());
|
|
|
|
WriteParam(msg, param.Y());
|
|
|
|
WriteParam(msg, param.Width());
|
|
|
|
WriteParam(msg, param.Height());
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter,
|
|
|
|
paramType* result) {
|
2017-12-19 23:48:39 +03:00
|
|
|
auto x = result->X();
|
|
|
|
auto y = result->Y();
|
|
|
|
auto w = result->Width();
|
|
|
|
auto h = result->Height();
|
|
|
|
|
|
|
|
bool retVal = (ReadParam(msg, iter, &x) && ReadParam(msg, iter, &y) &&
|
|
|
|
ReadParam(msg, iter, &w) && ReadParam(msg, iter, &h));
|
|
|
|
result->SetRect(x, y, w, h);
|
|
|
|
return retVal;
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-04-04 09:16:55 +03:00
|
|
|
template <class T>
|
|
|
|
struct ParamTraits<mozilla::gfx::RectAbsoluteTyped<T>> {
|
|
|
|
typedef mozilla::gfx::RectAbsoluteTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param) {
|
|
|
|
WriteParam(msg, param.Left());
|
|
|
|
WriteParam(msg, param.Top());
|
2020-04-09 00:06:56 +03:00
|
|
|
WriteParam(msg, param.Right());
|
2020-04-04 09:16:55 +03:00
|
|
|
WriteParam(msg, param.Bottom());
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, PickleIterator* iter,
|
|
|
|
paramType* result) {
|
|
|
|
auto l = result->Left();
|
|
|
|
auto t = result->Top();
|
2020-04-09 00:06:56 +03:00
|
|
|
auto r = result->Right();
|
2020-04-04 09:16:55 +03:00
|
|
|
auto b = result->Bottom();
|
|
|
|
|
2020-04-09 00:06:56 +03:00
|
|
|
bool retVal = (ReadParam(msg, iter, &l) && ReadParam(msg, iter, &t) &&
|
|
|
|
ReadParam(msg, iter, &r) && ReadParam(msg, iter, &b));
|
|
|
|
result->SetBox(l, t, r, b);
|
2020-04-04 09:16:55 +03:00
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-07-26 23:28:31 +04:00
|
|
|
template <class T>
|
|
|
|
struct ParamTraits<mozilla::gfx::IntRectTyped<T>> {
|
|
|
|
typedef mozilla::gfx::IntRectTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param) {
|
2017-12-19 23:48:39 +03:00
|
|
|
WriteParam(msg, param.X());
|
|
|
|
WriteParam(msg, param.Y());
|
|
|
|
WriteParam(msg, param.Width());
|
|
|
|
WriteParam(msg, param.Height());
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter,
|
|
|
|
paramType* result) {
|
2017-12-19 23:48:39 +03:00
|
|
|
auto x = result->X();
|
|
|
|
auto y = result->Y();
|
|
|
|
auto w = result->Width();
|
|
|
|
auto h = result->Height();
|
|
|
|
|
|
|
|
bool retVal = (ReadParam(msg, iter, &x) && ReadParam(msg, iter, &y) &&
|
|
|
|
ReadParam(msg, iter, &w) && ReadParam(msg, iter, &h));
|
|
|
|
result->SetRect(x, y, w, h);
|
|
|
|
return retVal;
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-03-04 11:16:31 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* 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::IntMarginTyped<T>> {
|
|
|
|
typedef mozilla::gfx::IntMarginTyped<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) {
|
2017-12-19 23:48:39 +03:00
|
|
|
WriteParam(msg, param.X());
|
|
|
|
WriteParam(msg, param.Y());
|
|
|
|
WriteParam(msg, param.Width());
|
|
|
|
WriteParam(msg, param.Height());
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* msg, PickleIterator* iter,
|
|
|
|
paramType* result) {
|
2017-12-19 23:48:39 +03:00
|
|
|
auto x = result->X();
|
|
|
|
auto y = result->Y();
|
|
|
|
auto w = result->Width();
|
|
|
|
auto h = result->Height();
|
|
|
|
bool retVal = (ReadParam(msg, iter, &x) && ReadParam(msg, iter, &y) &&
|
|
|
|
ReadParam(msg, iter, &w) && ReadParam(msg, iter, &h));
|
|
|
|
result->SetRect(x, y, w, h);
|
|
|
|
return retVal;
|
2013-07-26 23:28:31 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
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<mozilla::gfx::SurfaceFormat,
|
2014-04-14 18:17:40 +04:00
|
|
|
mozilla::gfx::SurfaceFormat::B8G8R8A8,
|
|
|
|
mozilla::gfx::SurfaceFormat::UNKNOWN> {};
|
2013-07-26 23:28:31 +04:00
|
|
|
|
2018-09-25 23:44:55 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorDepth>
|
2021-03-19 03:58:23 +03:00
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::gfx::ColorDepth, mozilla::gfx::ColorDepth::_First,
|
|
|
|
mozilla::gfx::ColorDepth::_Last> {};
|
2018-09-25 23:44:55 +03:00
|
|
|
|
2019-07-26 11:45:22 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorRange>
|
2021-03-19 03:58:23 +03:00
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::gfx::ColorRange, mozilla::gfx::ColorRange::_First,
|
|
|
|
mozilla::gfx::ColorRange::_Last> {};
|
2019-07-26 11:45:22 +03:00
|
|
|
|
2019-04-11 15:41:33 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::YUVColorSpace>
|
2021-03-19 03:58:23 +03:00
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::gfx::YUVColorSpace, mozilla::gfx::YUVColorSpace::_First,
|
|
|
|
mozilla::gfx::YUVColorSpace::_Last> {};
|
2019-04-11 15:36:31 +03:00
|
|
|
|
2021-06-25 22:16:22 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::YUVRangedColorSpace>
|
|
|
|
: public ContiguousEnumSerializerInclusive<
|
|
|
|
mozilla::gfx::YUVRangedColorSpace,
|
|
|
|
mozilla::gfx::YUVRangedColorSpace::_First,
|
|
|
|
mozilla::gfx::YUVRangedColorSpace::_Last> {};
|
|
|
|
|
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
|
|
|
|
2014-03-20 06:12:45 +04:00
|
|
|
template <>
|
2018-09-19 20:18:16 +03:00
|
|
|
struct ParamTraits<mozilla::gfx::ImplicitlyCopyableFloatArray>
|
|
|
|
: public ParamTraits<nsTArray<float>> {
|
|
|
|
typedef mozilla::gfx::ImplicitlyCopyableFloatArray paramType;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::EmptyAttributes> {
|
|
|
|
typedef mozilla::gfx::EmptyAttributes paramType;
|
2014-03-20 06:12:45 +04:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {}
|
2018-09-19 20:18:16 +03:00
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::MergeAttributes> {
|
|
|
|
typedef mozilla::gfx::MergeAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ToAlphaAttributes> {
|
|
|
|
typedef mozilla::gfx::ToAlphaAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::TileAttributes> {
|
|
|
|
typedef mozilla::gfx::TileAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::BlendAttributes> {
|
|
|
|
typedef mozilla::gfx::BlendAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mBlendMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mBlendMode);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::MorphologyAttributes> {
|
|
|
|
typedef mozilla::gfx::MorphologyAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mOperator);
|
|
|
|
WriteParam(aMsg, aParam.mRadii);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mOperator) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mRadii)) {
|
|
|
|
return false;
|
2015-09-29 17:49:41 +03:00
|
|
|
}
|
2018-09-19 20:18:16 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::FloodAttributes> {
|
|
|
|
typedef mozilla::gfx::FloodAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mColor)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::OpacityAttributes> {
|
|
|
|
typedef mozilla::gfx::OpacityAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mOpacity);
|
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) {
|
2018-09-19 20:18:16 +03:00
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mOpacity)) {
|
2014-03-20 06:12:45 +04:00
|
|
|
return false;
|
|
|
|
}
|
2018-09-19 20:18:16 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::OffsetAttributes> {
|
|
|
|
typedef mozilla::gfx::OffsetAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mValue)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::DisplacementMapAttributes> {
|
|
|
|
typedef mozilla::gfx::DisplacementMapAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mScale);
|
|
|
|
WriteParam(aMsg, aParam.mXChannel);
|
|
|
|
WriteParam(aMsg, aParam.mYChannel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mScale) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mXChannel) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mYChannel)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::TurbulenceAttributes> {
|
|
|
|
typedef mozilla::gfx::TurbulenceAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mOffset);
|
|
|
|
WriteParam(aMsg, aParam.mBaseFrequency);
|
|
|
|
WriteParam(aMsg, aParam.mSeed);
|
|
|
|
WriteParam(aMsg, aParam.mOctaves);
|
|
|
|
WriteParam(aMsg, aParam.mStitchable);
|
|
|
|
WriteParam(aMsg, aParam.mType);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mOffset) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mBaseFrequency) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mSeed) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mOctaves) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mStitchable) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mType)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ImageAttributes> {
|
|
|
|
typedef mozilla::gfx::ImageAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mFilter);
|
|
|
|
WriteParam(aMsg, aParam.mInputIndex);
|
|
|
|
WriteParam(aMsg, aParam.mTransform);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mFilter) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mInputIndex) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mTransform)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::GaussianBlurAttributes> {
|
|
|
|
typedef mozilla::gfx::GaussianBlurAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mStdDeviation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mStdDeviation)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::DropShadowAttributes> {
|
|
|
|
typedef mozilla::gfx::DropShadowAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mStdDeviation);
|
|
|
|
WriteParam(aMsg, aParam.mOffset);
|
|
|
|
WriteParam(aMsg, aParam.mColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mStdDeviation) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mOffset) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mColor)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ColorMatrixAttributes> {
|
|
|
|
typedef mozilla::gfx::ColorMatrixAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mType);
|
|
|
|
WriteParam(aMsg, aParam.mValues);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mType) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mValues)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ComponentTransferAttributes> {
|
|
|
|
typedef mozilla::gfx::ComponentTransferAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
WriteParam(aMsg, aParam.mTypes[i]);
|
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
WriteParam(aMsg, aParam.mValues[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mTypes[i])) {
|
2014-03-20 06:12:45 +04:00
|
|
|
return false;
|
|
|
|
}
|
2018-09-19 20:18:16 +03:00
|
|
|
}
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mValues[i])) {
|
2014-03-20 06:12:45 +04:00
|
|
|
return false;
|
|
|
|
}
|
2018-09-19 20:18:16 +03:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::ConvolveMatrixAttributes> {
|
|
|
|
typedef mozilla::gfx::ConvolveMatrixAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mKernelSize);
|
|
|
|
WriteParam(aMsg, aParam.mKernelMatrix);
|
|
|
|
WriteParam(aMsg, aParam.mDivisor);
|
|
|
|
WriteParam(aMsg, aParam.mBias);
|
|
|
|
WriteParam(aMsg, aParam.mTarget);
|
|
|
|
WriteParam(aMsg, aParam.mEdgeMode);
|
|
|
|
WriteParam(aMsg, aParam.mKernelUnitLength);
|
|
|
|
WriteParam(aMsg, aParam.mPreserveAlpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mKernelSize) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mKernelMatrix) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mDivisor) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mBias) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mTarget) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mEdgeMode) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mPreserveAlpha)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::DiffuseLightingAttributes> {
|
|
|
|
typedef mozilla::gfx::DiffuseLightingAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mLightType);
|
|
|
|
WriteParam(aMsg, aParam.mLightValues);
|
|
|
|
WriteParam(aMsg, aParam.mSurfaceScale);
|
|
|
|
WriteParam(aMsg, aParam.mKernelUnitLength);
|
|
|
|
WriteParam(aMsg, aParam.mColor);
|
|
|
|
WriteParam(aMsg, aParam.mLightingConstant);
|
|
|
|
WriteParam(aMsg, aParam.mSpecularExponent);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mLightType) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mLightValues) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mSurfaceScale) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mColor) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mLightingConstant) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mSpecularExponent)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::SpecularLightingAttributes> {
|
|
|
|
typedef mozilla::gfx::SpecularLightingAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mLightType);
|
|
|
|
WriteParam(aMsg, aParam.mLightValues);
|
|
|
|
WriteParam(aMsg, aParam.mSurfaceScale);
|
|
|
|
WriteParam(aMsg, aParam.mKernelUnitLength);
|
|
|
|
WriteParam(aMsg, aParam.mColor);
|
|
|
|
WriteParam(aMsg, aParam.mLightingConstant);
|
|
|
|
WriteParam(aMsg, aParam.mSpecularExponent);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mLightType) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mLightValues) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mSurfaceScale) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mColor) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mLightingConstant) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mSpecularExponent)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfx::CompositeAttributes> {
|
|
|
|
typedef mozilla::gfx::CompositeAttributes paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mOperator);
|
|
|
|
WriteParam(aMsg, aParam.mCoefficients);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mOperator) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mCoefficients)) {
|
|
|
|
return false;
|
2014-03-20 06:12:45 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-11-30 02:06:34 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::SideBits>
|
|
|
|
: public BitFlagsEnumSerializer<mozilla::SideBits,
|
|
|
|
mozilla::SideBits::eAll> {};
|
|
|
|
|
2019-11-28 10:29:33 +03:00
|
|
|
} /* namespace IPC */
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
2018-09-25 05:48:02 +03:00
|
|
|
template <>
|
2019-11-28 10:29:33 +03:00
|
|
|
struct IPDLParamTraits<gfx::PaintFragment> {
|
2018-09-25 05:48:02 +03:00
|
|
|
typedef mozilla::gfx::PaintFragment paramType;
|
2019-11-28 10:29:33 +03:00
|
|
|
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
|
|
|
|
Shmem shmem;
|
|
|
|
if (aParam.mSize.IsEmpty() ||
|
|
|
|
!aActor->AllocShmem(aParam.mRecording.mLen, SharedMemory::TYPE_BASIC,
|
|
|
|
&shmem)) {
|
|
|
|
WriteParam(aMsg, gfx::IntSize(0, 0));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(shmem.get<uint8_t>(), aParam.mRecording.mData,
|
|
|
|
aParam.mRecording.mLen);
|
|
|
|
|
2018-09-25 05:48:02 +03:00
|
|
|
WriteParam(aMsg, aParam.mSize);
|
2021-08-04 03:14:29 +03:00
|
|
|
WriteIPDLParam(aMsg, aActor, std::move(shmem));
|
2018-09-25 05:48:02 +03:00
|
|
|
WriteParam(aMsg, aParam.mDependencies);
|
|
|
|
}
|
|
|
|
|
2019-11-28 10:29:33 +03:00
|
|
|
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
|
|
|
IProtocol* aActor, paramType* aResult) {
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->mSize)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (aResult->mSize.IsEmpty()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
Shmem shmem;
|
|
|
|
if (!ReadIPDLParam(aMsg, aIter, aActor, &shmem) ||
|
|
|
|
!ReadParam(aMsg, aIter, &aResult->mDependencies)) {
|
|
|
|
aActor->DeallocShmem(shmem);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!aResult->mRecording.Allocate(shmem.Size<uint8_t>())) {
|
|
|
|
aResult->mSize.SizeTo(0, 0);
|
|
|
|
aActor->DeallocShmem(shmem);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(aResult->mRecording.mData, shmem.get<uint8_t>(),
|
|
|
|
shmem.Size<uint8_t>());
|
|
|
|
aActor->DeallocShmem(shmem);
|
|
|
|
return true;
|
2018-09-25 05:48:02 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-01-09 01:19:14 +03:00
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|
2013-07-26 23:28:31 +04:00
|
|
|
|
|
|
|
#endif /* __GFXMESSAGEUTILS_H__ */
|