Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/GfxMessageUtils.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef __GFXMESSAGEUTILS_H__
8
#define __GFXMESSAGEUTILS_H__
9
10
#include "FilterSupport.h"
11
#include "FrameMetrics.h"
12
#include "ImageTypes.h"
13
#include "RegionBuilder.h"
14
#include "base/process_util.h"
15
#include "chrome/common/ipc_message_utils.h"
16
#include "gfxFeature.h"
17
#include "gfxFallback.h"
18
#include "gfxPoint.h"
19
#include "gfxRect.h"
20
#include "gfxTelemetry.h"
21
#include "gfxTypes.h"
22
#include "ipc/IPCMessageUtils.h"
23
#include "mozilla/gfx/CompositorHitTestInfo.h"
24
#include "mozilla/gfx/Matrix.h"
25
#include "nsRect.h"
26
#include "nsRegion.h"
27
#include "mozilla/Array.h"
28
29
#include <stdint.h>
30
31
#ifdef _MSC_VER
32
#pragma warning( disable : 4800 )
33
#endif
34
35
namespace mozilla {
36
37
typedef gfxImageFormat PixelFormat;
38
39
} // namespace
40
41
namespace IPC {
42
43
template<>
44
struct ParamTraits<mozilla::gfx::Matrix>
45
{
46
  typedef mozilla::gfx::Matrix paramType;
47
48
  static void Write(Message* aMsg, const paramType& aParam)
49
0
  {
50
0
    WriteParam(aMsg, aParam._11);
51
0
    WriteParam(aMsg, aParam._12);
52
0
    WriteParam(aMsg, aParam._21);
53
0
    WriteParam(aMsg, aParam._22);
54
0
    WriteParam(aMsg, aParam._31);
55
0
    WriteParam(aMsg, aParam._32);
56
0
  }
57
58
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
59
0
  {
60
0
    if (ReadParam(aMsg, aIter, &aResult->_11) &&
61
0
        ReadParam(aMsg, aIter, &aResult->_12) &&
62
0
        ReadParam(aMsg, aIter, &aResult->_21) &&
63
0
        ReadParam(aMsg, aIter, &aResult->_22) &&
64
0
        ReadParam(aMsg, aIter, &aResult->_31) &&
65
0
        ReadParam(aMsg, aIter, &aResult->_32))
66
0
      return true;
67
0
68
0
    return false;
69
0
  }
70
71
  static void Log(const paramType& aParam, std::wstring* aLog)
72
0
  {
73
0
    aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam._11, aParam._12, aParam._21, aParam._22,
74
0
                                                            aParam._31, aParam._32));
75
0
  }
76
};
77
78
template<>
79
struct ParamTraits<mozilla::gfx::Matrix4x4>
80
{
81
  typedef mozilla::gfx::Matrix4x4 paramType;
82
83
  static void Write(Message* msg, const paramType& param)
84
0
  {
85
0
#define Wr(_f)  WriteParam(msg, param. _f)
86
0
    Wr(_11); Wr(_12); Wr(_13); Wr(_14);
87
0
    Wr(_21); Wr(_22); Wr(_23); Wr(_24);
88
0
    Wr(_31); Wr(_32); Wr(_33); Wr(_34);
89
0
    Wr(_41); Wr(_42); Wr(_43); Wr(_44);
90
0
#undef Wr
91
0
  }
92
93
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
94
0
  {
95
0
#define Rd(_f)  ReadParam(msg, iter, &result-> _f)
96
0
    return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
97
0
            Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
98
0
            Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
99
0
            Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44));
100
0
#undef Rd
101
0
  }
102
};
103
104
template<>
105
struct ParamTraits<mozilla::gfx::Matrix5x4>
106
{
107
  typedef mozilla::gfx::Matrix5x4 paramType;
108
109
  static void Write(Message* msg, const paramType& param)
110
0
  {
111
0
#define Wr(_f)  WriteParam(msg, param. _f)
112
0
    Wr(_11); Wr(_12); Wr(_13); Wr(_14);
113
0
    Wr(_21); Wr(_22); Wr(_23); Wr(_24);
114
0
    Wr(_31); Wr(_32); Wr(_33); Wr(_34);
115
0
    Wr(_41); Wr(_42); Wr(_43); Wr(_44);
116
0
    Wr(_51); Wr(_52); Wr(_53); Wr(_54);
117
0
#undef Wr
118
0
  }
119
120
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
121
0
  {
122
0
#define Rd(_f)  ReadParam(msg, iter, &result-> _f)
123
0
    return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
124
0
            Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
125
0
            Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
126
0
            Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44) &&
127
0
            Rd(_51) && Rd(_52) && Rd(_53) && Rd(_54));
128
0
#undef Rd
129
0
  }
130
};
131
132
template<>
133
struct ParamTraits<gfxPoint>
134
{
135
  typedef gfxPoint paramType;
136
137
  static void Write(Message* aMsg, const paramType& aParam)
138
0
  {
139
0
    WriteParam(aMsg, aParam.x);
140
0
    WriteParam(aMsg, aParam.y);
141
0
  }
142
143
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
144
0
  {
145
0
    return (ReadParam(aMsg, aIter, &aResult->x) &&
146
0
            ReadParam(aMsg, aIter, &aResult->y));
147
0
 }
148
};
149
150
template<>
151
struct ParamTraits<gfxSize>
152
{
153
  typedef gfxSize paramType;
154
155
  static void Write(Message* aMsg, const paramType& aParam)
156
0
  {
157
0
    WriteParam(aMsg, aParam.width);
158
0
    WriteParam(aMsg, aParam.height);
159
0
  }
160
161
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
162
0
  {
163
0
    if (ReadParam(aMsg, aIter, &aResult->width) &&
164
0
        ReadParam(aMsg, aIter, &aResult->height))
165
0
      return true;
166
0
167
0
    return false;
168
0
  }
169
};
170
171
template<>
172
struct ParamTraits<gfxRect>
173
{
174
  typedef gfxRect paramType;
175
176
  static void Write(Message* aMsg, const paramType& aParam)
177
0
  {
178
0
    WriteParam(aMsg, aParam.X());
179
0
    WriteParam(aMsg, aParam.Y());
180
0
    WriteParam(aMsg, aParam.Width());
181
0
    WriteParam(aMsg, aParam.Height());
182
0
  }
183
184
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
185
0
  {
186
0
    auto x = aResult->X();
187
0
    auto y = aResult->Y();
188
0
    auto w = aResult->Width();
189
0
    auto h = aResult->Height();
190
0
191
0
    bool retVal = (ReadParam(aMsg, aIter, &x) &&
192
0
                   ReadParam(aMsg, aIter, &y) &&
193
0
                   ReadParam(aMsg, aIter, &w) &&
194
0
                   ReadParam(aMsg, aIter, &h));
195
0
    aResult->SetRect(x, y, w, h);
196
0
    return retVal;
197
0
  }
198
};
199
200
template <>
201
struct ParamTraits<gfxContentType>
202
  : public ContiguousEnumSerializer<
203
             gfxContentType,
204
             gfxContentType::COLOR,
205
             gfxContentType::SENTINEL>
206
{};
207
208
template <>
209
struct ParamTraits<gfxSurfaceType>
210
  : public ContiguousEnumSerializer<
211
             gfxSurfaceType,
212
             gfxSurfaceType::Image,
213
             gfxSurfaceType::Max>
214
{};
215
216
template <>
217
struct ParamTraits<mozilla::gfx::SamplingFilter>
218
  : public ContiguousEnumSerializer<
219
             mozilla::gfx::SamplingFilter,
220
             mozilla::gfx::SamplingFilter::GOOD,
221
             mozilla::gfx::SamplingFilter::SENTINEL>
222
{};
223
224
template <>
225
struct ParamTraits<mozilla::gfx::BackendType>
226
  : public ContiguousEnumSerializer<
227
             mozilla::gfx::BackendType,
228
             mozilla::gfx::BackendType::NONE,
229
             mozilla::gfx::BackendType::BACKEND_LAST>
230
{};
231
232
template <>
233
struct ParamTraits<mozilla::gfx::Feature>
234
  : public ContiguousEnumSerializer<
235
             mozilla::gfx::Feature,
236
             mozilla::gfx::Feature::HW_COMPOSITING,
237
             mozilla::gfx::Feature::NumValues>
238
{};
239
240
template <>
241
struct ParamTraits<mozilla::gfx::Fallback>
242
  : public ContiguousEnumSerializer<
243
             mozilla::gfx::Fallback,
244
             mozilla::gfx::Fallback::NO_CONSTANT_BUFFER_OFFSETTING,
245
             mozilla::gfx::Fallback::NumValues>
246
{};
247
248
template <>
249
struct ParamTraits<mozilla::gfx::FeatureStatus>
250
  : public ContiguousEnumSerializer<
251
             mozilla::gfx::FeatureStatus,
252
             mozilla::gfx::FeatureStatus::Unused,
253
             mozilla::gfx::FeatureStatus::LAST>
254
{};
255
256
template <>
257
struct ParamTraits<mozilla::gfx::LightType>
258
  : public ContiguousEnumSerializer<
259
             mozilla::gfx::LightType,
260
             mozilla::gfx::LightType::None,
261
             mozilla::gfx::LightType::Max>
262
{};
263
264
template <>
265
struct ParamTraits<mozilla::gfx::ColorSpace>
266
  : public ContiguousEnumSerializer<
267
             mozilla::gfx::ColorSpace,
268
             mozilla::gfx::ColorSpace::SRGB,
269
             mozilla::gfx::ColorSpace::Max>
270
{};
271
272
/*
273
template <>
274
struct ParamTraits<mozilla::PixelFormat>
275
  : public EnumSerializer<mozilla::PixelFormat,
276
                          SurfaceFormat::A8R8G8B8_UINT32,
277
                          SurfaceFormat::UNKNOWN>
278
{};
279
*/
280
281
template<>
282
struct ParamTraits<mozilla::gfx::Color>
283
{
284
  typedef mozilla::gfx::Color paramType;
285
286
  static void Write(Message* msg, const paramType& param)
287
0
  {
288
0
    WriteParam(msg, param.r);
289
0
    WriteParam(msg, param.g);
290
0
    WriteParam(msg, param.b);
291
0
    WriteParam(msg, param.a);
292
0
  }
293
294
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
295
0
  {
296
0
    return (ReadParam(msg, iter, &result->r) &&
297
0
            ReadParam(msg, iter, &result->g) &&
298
0
            ReadParam(msg, iter, &result->b) &&
299
0
            ReadParam(msg, iter, &result->a));
300
0
  }
301
};
302
303
template<>
304
struct ParamTraits<nsPoint>
305
{
306
  typedef nsPoint paramType;
307
308
  static void Write(Message* msg, const paramType& param)
309
0
  {
310
0
    WriteParam(msg, param.x);
311
0
    WriteParam(msg, param.y);
312
0
  }
313
314
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
315
0
  {
316
0
    return (ReadParam(msg, iter, &result->x) &&
317
0
            ReadParam(msg, iter, &result->y));
318
0
  }
319
};
320
321
template<>
322
struct ParamTraits<nsIntPoint>
323
{
324
  typedef nsIntPoint paramType;
325
326
  static void Write(Message* msg, const paramType& param)
327
0
  {
328
0
    WriteParam(msg, param.x);
329
0
    WriteParam(msg, param.y);
330
0
  }
331
332
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
333
0
  {
334
0
    return (ReadParam(msg, iter, &result->x) &&
335
0
            ReadParam(msg, iter, &result->y));
336
0
  }
337
};
338
339
template<typename T>
340
struct ParamTraits<mozilla::gfx::IntSizeTyped<T> >
341
{
342
  typedef mozilla::gfx::IntSizeTyped<T> paramType;
343
344
  static void Write(Message* msg, const paramType& param)
345
0
  {
346
0
    WriteParam(msg, param.width);
347
0
    WriteParam(msg, param.height);
348
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel> >::Write(IPC::Message*, mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel> >::Write(IPC::Message*, mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel> const&)
349
350
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
351
0
  {
352
0
    return (ReadParam(msg, iter, &result->width) &&
353
0
            ReadParam(msg, iter, &result->height));
354
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel>*)
355
};
356
357
template<typename Region, typename Rect, typename Iter>
358
struct RegionParamTraits
359
{
360
  typedef Region paramType;
361
362
  static void Write(Message* msg, const paramType& param)
363
0
  {
364
0
365
0
    for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) {
366
0
      const Rect& r = iter.Get();
367
0
      MOZ_RELEASE_ASSERT(!r.IsEmpty(), "GFX: rect is empty.");
368
0
      WriteParam(msg, r);
369
0
    }
370
0
    // empty rects are sentinel values because nsRegions will never
371
0
    // contain them
372
0
    WriteParam(msg, Rect());
373
0
  }
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator>::Write(IPC::Message*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator>::Write(IPC::Message*, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator>::Write(IPC::Message*, mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
374
375
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
376
0
  {
377
0
    RegionBuilder<Region> builder;
378
0
    Rect rect;
379
0
    while (ReadParam(msg, iter, &rect)) {
380
0
      if (rect.IsEmpty()) {
381
0
        *result = builder.ToRegion();
382
0
        return true;
383
0
      }
384
0
      builder.OrWith(rect);
385
0
    }
386
0
387
0
    return false;
388
0
  }
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator>::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>*)
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator>::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>*)
Unexecuted instantiation: IPC::RegionParamTraits<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator>::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>*)
389
};
390
391
template<class Units>
392
struct ParamTraits<mozilla::gfx::IntRegionTyped<Units>>
393
  : RegionParamTraits<mozilla::gfx::IntRegionTyped<Units>,
394
                      mozilla::gfx::IntRectTyped<Units>,
395
                      typename mozilla::gfx::IntRegionTyped<Units>::RectIterator>
396
{};
397
398
template<>
399
struct ParamTraits<mozilla::gfx::IntSize>
400
{
401
  typedef mozilla::gfx::IntSize paramType;
402
403
  static void Write(Message* msg, const paramType& param)
404
0
  {
405
0
    WriteParam(msg, param.width);
406
0
    WriteParam(msg, param.height);
407
0
  }
408
409
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
410
0
  {
411
0
    return (ReadParam(msg, iter, &result->width) &&
412
0
            ReadParam(msg, iter, &result->height));
413
0
  }
414
};
415
416
template<class T>
417
struct ParamTraits< mozilla::gfx::CoordTyped<T> >
418
{
419
  typedef mozilla::gfx::CoordTyped<T> paramType;
420
421
  static void Write(Message* msg, const paramType& param)
422
0
  {
423
0
    WriteParam(msg, param.value);
424
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::Write(IPC::Message*, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::Write(IPC::Message*, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::Write(IPC::Message*, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> const&)
425
426
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
427
0
  {
428
0
    return (ReadParam(msg, iter, &result->value));
429
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float>*)
430
};
431
432
template<class T>
433
struct ParamTraits< mozilla::gfx::IntCoordTyped<T> >
434
{
435
  typedef mozilla::gfx::IntCoordTyped<T> paramType;
436
437
  static void Write(Message* msg, const paramType& param)
438
  {
439
    WriteParam(msg, param.value);
440
  }
441
442
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
443
  {
444
    return (ReadParam(msg, iter, &result->value));
445
  }
446
};
447
448
template<class T, class U>
449
struct ParamTraits< mozilla::gfx::ScaleFactor<T, U> >
450
{
451
  typedef mozilla::gfx::ScaleFactor<T, U> paramType;
452
453
  static void Write(Message* msg, const paramType& param)
454
0
  {
455
0
    WriteParam(msg, param.scale);
456
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::LayoutDevicePixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::DesktopPixel, mozilla::LayoutDevicePixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactor<mozilla::DesktopPixel, mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel> const&)
457
458
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
459
0
  {
460
0
    return (ReadParam(msg, iter, &result->scale));
461
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::LayoutDevicePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::LayoutDevicePixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::DesktopPixel, mozilla::LayoutDevicePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactor<mozilla::DesktopPixel, mozilla::LayoutDevicePixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel>*)
462
};
463
464
template<class T, class U>
465
struct ParamTraits< mozilla::gfx::ScaleFactors2D<T, U> >
466
{
467
  typedef mozilla::gfx::ScaleFactors2D<T, U> paramType;
468
469
  static void Write(Message* msg, const paramType& param)
470
0
  {
471
0
    WriteParam(msg, param.xScale);
472
0
    WriteParam(msg, param.yScale);
473
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::LayoutDevicePixel, mozilla::LayerPixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactors2D<mozilla::LayoutDevicePixel, mozilla::LayerPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::CSSPixel, mozilla::ParentLayerPixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactors2D<mozilla::CSSPixel, mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::ScreenPixel, mozilla::LayerPixel> >::Write(IPC::Message*, mozilla::gfx::ScaleFactors2D<mozilla::ScreenPixel, mozilla::LayerPixel> const&)
474
475
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
476
0
  {
477
0
    return (ReadParam(msg, iter, &result->xScale) &&
478
0
            ReadParam(msg, iter, &result->yScale));
479
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::LayoutDevicePixel, mozilla::LayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactors2D<mozilla::LayoutDevicePixel, mozilla::LayerPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::CSSPixel, mozilla::ParentLayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactors2D<mozilla::CSSPixel, mozilla::ParentLayerPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::ScaleFactors2D<mozilla::ScreenPixel, mozilla::LayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::ScaleFactors2D<mozilla::ScreenPixel, mozilla::LayerPixel>*)
480
};
481
482
template<class T>
483
struct ParamTraits< mozilla::gfx::PointTyped<T> >
484
{
485
  typedef mozilla::gfx::PointTyped<T> paramType;
486
487
  static void Write(Message* msg, const paramType& param)
488
0
  {
489
0
    WriteParam(msg, param.x);
490
0
    WriteParam(msg, param.y);
491
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> >::Write(IPC::Message*, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> >::Write(IPC::Message*, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> >::Write(IPC::Message*, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::CSSPixel, float> >::Write(IPC::Message*, mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> >::Write(IPC::Message*, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> const&)
492
493
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
494
0
  {
495
0
    return (ReadParam(msg, iter, &result->x) &&
496
0
            ReadParam(msg, iter, &result->y));
497
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::CSSPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>*)
498
};
499
500
template<class F, class T>
501
struct ParamTraits< mozilla::gfx::Point3DTyped<F, T> >
502
{
503
  typedef mozilla::gfx::Point3DTyped<F, T> paramType;
504
505
  static void Write(Message* msg, const paramType& param)
506
0
  {
507
0
    WriteParam(msg, param.x);
508
0
    WriteParam(msg, param.y);
509
0
    WriteParam(msg, param.z);
510
0
  }
511
512
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
513
0
  {
514
0
    return (ReadParam(msg, iter, &result->x) &&
515
0
            ReadParam(msg, iter, &result->y) &&
516
0
            ReadParam(msg, iter, &result->z));
517
0
  }
518
};
519
520
template<class T>
521
struct ParamTraits< mozilla::gfx::IntPointTyped<T> >
522
{
523
  typedef mozilla::gfx::IntPointTyped<T> paramType;
524
525
  static void Write(Message* msg, const paramType& param)
526
0
  {
527
0
    WriteParam(msg, param.x);
528
0
    WriteParam(msg, param.y);
529
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> >::Write(IPC::Message*, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> >::Write(IPC::Message*, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&)
530
531
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
532
0
  {
533
0
    return (ReadParam(msg, iter, &result->x) &&
534
0
            ReadParam(msg, iter, &result->y));
535
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>*)
536
};
537
538
template<class T>
539
struct ParamTraits< mozilla::gfx::SizeTyped<T> >
540
{
541
  typedef mozilla::gfx::SizeTyped<T> paramType;
542
543
  static void Write(Message* msg, const paramType& param)
544
0
  {
545
0
    WriteParam(msg, param.width);
546
0
    WriteParam(msg, param.height);
547
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> >::Write(IPC::Message*, mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::ScreenPixel, float> >::Write(IPC::Message*, mozilla::gfx::SizeTyped<mozilla::ScreenPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::CSSPixel, float> >::Write(IPC::Message*, mozilla::gfx::SizeTyped<mozilla::CSSPixel, float> const&)
548
549
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
550
0
  {
551
0
    return (ReadParam(msg, iter, &result->width) &&
552
0
            ReadParam(msg, iter, &result->height));
553
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::ScreenPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::SizeTyped<mozilla::ScreenPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::SizeTyped<mozilla::CSSPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::SizeTyped<mozilla::CSSPixel, float>*)
554
};
555
556
template<class T>
557
struct ParamTraits< mozilla::gfx::RectTyped<T> >
558
{
559
  typedef mozilla::gfx::RectTyped<T> paramType;
560
561
  static void Write(Message* msg, const paramType& param)
562
0
  {
563
0
    WriteParam(msg, param.X());
564
0
    WriteParam(msg, param.Y());
565
0
    WriteParam(msg, param.Width());
566
0
    WriteParam(msg, param.Height());
567
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> >::Write(IPC::Message*, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::CSSPixel, float> >::Write(IPC::Message*, mozilla::gfx::RectTyped<mozilla::CSSPixel, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> >::Write(IPC::Message*, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float> >::Write(IPC::Message*, mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float> const&)
568
569
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
570
0
  {
571
0
    auto x = result->X();
572
0
    auto y = result->Y();
573
0
    auto w = result->Width();
574
0
    auto h = result->Height();
575
0
576
0
    bool retVal = (ReadParam(msg, iter, &x) &&
577
0
                   ReadParam(msg, iter, &y) &&
578
0
                   ReadParam(msg, iter, &w) &&
579
0
                   ReadParam(msg, iter, &h));
580
0
    result->SetRect(x, y, w, h);
581
0
    return retVal;
582
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::CSSPixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::RectTyped<mozilla::CSSPixel, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float>*)
583
};
584
585
template<class T>
586
struct ParamTraits< mozilla::gfx::IntRectTyped<T> >
587
{
588
  typedef mozilla::gfx::IntRectTyped<T> paramType;
589
590
  static void Write(Message* msg, const paramType& param)
591
0
  {
592
0
    WriteParam(msg, param.X());
593
0
    WriteParam(msg, param.Y());
594
0
    WriteParam(msg, param.Width());
595
0
    WriteParam(msg, param.Height());
596
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::DesktopPixel> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::DesktopPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::LayerPixel> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::ImagePixel> >::Write(IPC::Message*, mozilla::gfx::IntRectTyped<mozilla::ImagePixel> const&)
597
598
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
599
0
  {
600
0
    auto x = result->X();
601
0
    auto y = result->Y();
602
0
    auto w = result->Width();
603
0
    auto h = result->Height();
604
0
605
0
    bool retVal = (ReadParam(msg, iter, &x) &&
606
0
                   ReadParam(msg, iter, &y) &&
607
0
                   ReadParam(msg, iter, &w) &&
608
0
                   ReadParam(msg, iter, &h));
609
0
    result->SetRect(x, y, w, h);
610
0
    return retVal;
611
0
  }
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::DesktopPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::DesktopPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::LayerPixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>*)
Unexecuted instantiation: IPC::ParamTraits<mozilla::gfx::IntRectTyped<mozilla::ImagePixel> >::Read(IPC::Message const*, PickleIterator*, mozilla::gfx::IntRectTyped<mozilla::ImagePixel>*)
612
};
613
614
template<>
615
struct ParamTraits<mozilla::gfx::Margin>
616
{
617
  typedef mozilla::gfx::Margin paramType;
618
619
  static void Write(Message* msg, const paramType& param)
620
0
  {
621
0
    WriteParam(msg, param.top);
622
0
    WriteParam(msg, param.right);
623
0
    WriteParam(msg, param.bottom);
624
0
    WriteParam(msg, param.left);
625
0
  }
626
627
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
628
0
  {
629
0
    return (ReadParam(msg, iter, &result->top) &&
630
0
            ReadParam(msg, iter, &result->right) &&
631
0
            ReadParam(msg, iter, &result->bottom) &&
632
0
            ReadParam(msg, iter, &result->left));
633
0
  }
634
};
635
636
template<class T>
637
struct ParamTraits< mozilla::gfx::MarginTyped<T> >
638
{
639
  typedef mozilla::gfx::MarginTyped<T> paramType;
640
641
  static void Write(Message* msg, const paramType& param)
642
0
  {
643
0
    WriteParam(msg, param.top);
644
0
    WriteParam(msg, param.right);
645
0
    WriteParam(msg, param.bottom);
646
0
    WriteParam(msg, param.left);
647
0
  }
648
649
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
650
0
  {
651
0
    return (ReadParam(msg, iter, &result->top) &&
652
0
            ReadParam(msg, iter, &result->right) &&
653
0
            ReadParam(msg, iter, &result->bottom) &&
654
0
            ReadParam(msg, iter, &result->left));
655
0
  }
656
};
657
658
template<>
659
struct ParamTraits<nsRect>
660
{
661
  typedef nsRect paramType;
662
663
  static void Write(Message* msg, const paramType& param)
664
0
  {
665
0
    WriteParam(msg, param.X());
666
0
    WriteParam(msg, param.Y());
667
0
    WriteParam(msg, param.Width());
668
0
    WriteParam(msg, param.Height());
669
0
  }
670
671
  static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
672
0
  {
673
0
    auto x = result->X();
674
0
    auto y = result->Y();
675
0
    auto w = result->Width();
676
0
    auto h = result->Height();
677
0
    bool retVal = (ReadParam(msg, iter, &x) &&
678
0
                   ReadParam(msg, iter, &y) &&
679
0
                   ReadParam(msg, iter, &w) &&
680
0
                   ReadParam(msg, iter, &h));
681
0
    result->SetRect(x, y, w, h);
682
0
    return retVal;
683
0
  }
684
};
685
686
template<>
687
struct ParamTraits<nsRegion>
688
  : RegionParamTraits<nsRegion, nsRect, nsRegion::RectIterator>
689
{};
690
691
template<>
692
struct ParamTraits<GeckoProcessType>
693
  : public ContiguousEnumSerializer<
694
             GeckoProcessType,
695
             GeckoProcessType_Default,
696
             GeckoProcessType_End>
697
{};
698
699
template <>
700
struct ParamTraits<mozilla::gfx::SurfaceFormat>
701
  : public ContiguousEnumSerializer<
702
             mozilla::gfx::SurfaceFormat,
703
             mozilla::gfx::SurfaceFormat::B8G8R8A8,
704
             mozilla::gfx::SurfaceFormat::UNKNOWN>
705
{};
706
707
template <>
708
struct ParamTraits<mozilla::StereoMode>
709
  : public ContiguousEnumSerializer<
710
             mozilla::StereoMode,
711
             mozilla::StereoMode::MONO,
712
             mozilla::StereoMode::MAX>
713
{};
714
715
template <>
716
struct ParamTraits<mozilla::YUVColorSpace>
717
  : public ContiguousEnumSerializer<
718
             mozilla::YUVColorSpace,
719
             mozilla::YUVColorSpace::BT601,
720
             mozilla::YUVColorSpace::UNKNOWN>
721
{};
722
723
template <>
724
struct ParamTraits<mozilla::gfx::ImplicitlyCopyableFloatArray>
725
  : public ParamTraits<nsTArray<float>>
726
{
727
  typedef mozilla::gfx::ImplicitlyCopyableFloatArray paramType;
728
};
729
730
template <>
731
struct ParamTraits<mozilla::gfx::EmptyAttributes>
732
{
733
  typedef mozilla::gfx::EmptyAttributes paramType;
734
735
  static void Write(Message* aMsg, const paramType& aParam)
736
0
  {
737
0
  }
738
739
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
740
0
  {
741
0
    return true;
742
0
  }
743
};
744
745
template <>
746
struct ParamTraits<mozilla::gfx::MergeAttributes>
747
{
748
  typedef mozilla::gfx::MergeAttributes paramType;
749
750
  static void Write(Message* aMsg, const paramType& aParam)
751
0
  {
752
0
  }
753
754
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
755
0
  {
756
0
    return true;
757
0
  }
758
};
759
760
template <>
761
struct ParamTraits<mozilla::gfx::ToAlphaAttributes>
762
{
763
  typedef mozilla::gfx::ToAlphaAttributes paramType;
764
765
  static void Write(Message* aMsg, const paramType& aParam)
766
0
  {
767
0
  }
768
769
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
770
0
  {
771
0
    return true;
772
0
  }
773
};
774
775
template <>
776
struct ParamTraits<mozilla::gfx::TileAttributes>
777
{
778
  typedef mozilla::gfx::TileAttributes paramType;
779
780
  static void Write(Message* aMsg, const paramType& aParam)
781
0
  {
782
0
  }
783
784
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
785
0
  {
786
0
    return true;
787
0
  }
788
};
789
790
template <>
791
struct ParamTraits<mozilla::gfx::BlendAttributes>
792
{
793
  typedef mozilla::gfx::BlendAttributes paramType;
794
795
  static void Write(Message* aMsg, const paramType& aParam)
796
0
  {
797
0
    WriteParam(aMsg, aParam.mBlendMode);
798
0
  }
799
800
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
801
0
  {
802
0
    return ReadParam(aMsg, aIter, &aResult->mBlendMode);
803
0
  }
804
};
805
806
template<>
807
struct ParamTraits<mozilla::gfx::MorphologyAttributes>
808
{
809
  typedef mozilla::gfx::MorphologyAttributes paramType;
810
811
  static void Write(Message* aMsg, const paramType& aParam)
812
0
  {
813
0
    WriteParam(aMsg, aParam.mOperator);
814
0
    WriteParam(aMsg, aParam.mRadii);
815
0
  }
816
817
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
818
0
  {
819
0
    if (!ReadParam(aMsg, aIter, &aResult->mOperator) ||
820
0
        !ReadParam(aMsg, aIter, &aResult->mRadii)) {
821
0
      return false;
822
0
    }
823
0
    return true;
824
0
  }
825
};
826
827
template<>
828
struct ParamTraits<mozilla::gfx::FloodAttributes>
829
{
830
  typedef mozilla::gfx::FloodAttributes paramType;
831
832
  static void Write(Message* aMsg, const paramType& aParam)
833
0
  {
834
0
    WriteParam(aMsg, aParam.mColor);
835
0
  }
836
837
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
838
0
  {
839
0
    if (!ReadParam(aMsg, aIter, &aResult->mColor)) {
840
0
      return false;
841
0
    }
842
0
    return true;
843
0
  }
844
};
845
846
template<>
847
struct ParamTraits<mozilla::gfx::OpacityAttributes>
848
{
849
  typedef mozilla::gfx::OpacityAttributes paramType;
850
851
  static void Write(Message* aMsg, const paramType& aParam)
852
0
  {
853
0
    WriteParam(aMsg, aParam.mOpacity);
854
0
  }
855
856
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
857
0
  {
858
0
    if (!ReadParam(aMsg, aIter, &aResult->mOpacity)) {
859
0
      return false;
860
0
    }
861
0
    return true;
862
0
  }
863
};
864
865
template<>
866
struct ParamTraits<mozilla::gfx::OffsetAttributes>
867
{
868
  typedef mozilla::gfx::OffsetAttributes paramType;
869
870
  static void Write(Message* aMsg, const paramType& aParam)
871
0
  {
872
0
    WriteParam(aMsg, aParam.mValue);
873
0
  }
874
875
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
876
0
  {
877
0
    if (!ReadParam(aMsg, aIter, &aResult->mValue)) {
878
0
      return false;
879
0
    }
880
0
    return true;
881
0
  }
882
};
883
884
template<>
885
struct ParamTraits<mozilla::gfx::DisplacementMapAttributes>
886
{
887
  typedef mozilla::gfx::DisplacementMapAttributes paramType;
888
889
  static void Write(Message* aMsg, const paramType& aParam)
890
0
  {
891
0
    WriteParam(aMsg, aParam.mScale);
892
0
    WriteParam(aMsg, aParam.mXChannel);
893
0
    WriteParam(aMsg, aParam.mYChannel);
894
0
  }
895
896
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
897
0
  {
898
0
    if (!ReadParam(aMsg, aIter, &aResult->mScale) ||
899
0
        !ReadParam(aMsg, aIter, &aResult->mXChannel) ||
900
0
        !ReadParam(aMsg, aIter, &aResult->mYChannel)) {
901
0
      return false;
902
0
  }
903
0
  return true;
904
0
  }
905
};
906
907
template<>
908
struct ParamTraits<mozilla::gfx::TurbulenceAttributes>
909
{
910
  typedef mozilla::gfx::TurbulenceAttributes paramType;
911
912
  static void Write(Message* aMsg, const paramType& aParam)
913
0
  {
914
0
    WriteParam(aMsg, aParam.mOffset);
915
0
    WriteParam(aMsg, aParam.mBaseFrequency);
916
0
    WriteParam(aMsg, aParam.mSeed);
917
0
    WriteParam(aMsg, aParam.mOctaves);
918
0
    WriteParam(aMsg, aParam.mStitchable);
919
0
    WriteParam(aMsg, aParam.mType);
920
0
  }
921
922
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
923
0
  {
924
0
    if (!ReadParam(aMsg, aIter, &aResult->mOffset) ||
925
0
        !ReadParam(aMsg, aIter, &aResult->mBaseFrequency) ||
926
0
        !ReadParam(aMsg, aIter, &aResult->mSeed) ||
927
0
        !ReadParam(aMsg, aIter, &aResult->mOctaves) ||
928
0
        !ReadParam(aMsg, aIter, &aResult->mStitchable) ||
929
0
        !ReadParam(aMsg, aIter, &aResult->mType)) {
930
0
      return false;
931
0
    }
932
0
    return true;
933
0
  }
934
};
935
936
template<>
937
struct ParamTraits<mozilla::gfx::ImageAttributes>
938
{
939
  typedef mozilla::gfx::ImageAttributes paramType;
940
941
  static void Write(Message* aMsg, const paramType& aParam)
942
0
  {
943
0
    WriteParam(aMsg, aParam.mFilter);
944
0
    WriteParam(aMsg, aParam.mInputIndex);
945
0
    WriteParam(aMsg, aParam.mTransform);
946
0
  }
947
948
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
949
0
  {
950
0
    if (!ReadParam(aMsg, aIter, &aResult->mFilter) ||
951
0
        !ReadParam(aMsg, aIter, &aResult->mInputIndex) ||
952
0
        !ReadParam(aMsg, aIter, &aResult->mTransform)) {
953
0
      return false;
954
0
    }
955
0
    return true;
956
0
  }
957
};
958
959
template<>
960
struct ParamTraits<mozilla::gfx::GaussianBlurAttributes>
961
{
962
  typedef mozilla::gfx::GaussianBlurAttributes paramType;
963
964
  static void Write(Message* aMsg, const paramType& aParam)
965
0
  {
966
0
    WriteParam(aMsg, aParam.mStdDeviation);
967
0
  }
968
969
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
970
0
  {
971
0
    if (!ReadParam(aMsg, aIter, &aResult->mStdDeviation)) {
972
0
      return false;
973
0
    }
974
0
    return true;
975
0
  }
976
};
977
978
template<>
979
struct ParamTraits<mozilla::gfx::DropShadowAttributes>
980
{
981
  typedef mozilla::gfx::DropShadowAttributes paramType;
982
983
  static void Write(Message* aMsg, const paramType& aParam)
984
0
  {
985
0
    WriteParam(aMsg, aParam.mStdDeviation);
986
0
    WriteParam(aMsg, aParam.mOffset);
987
0
    WriteParam(aMsg, aParam.mColor);
988
0
  }
989
990
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
991
0
  {
992
0
    if (!ReadParam(aMsg, aIter, &aResult->mStdDeviation) ||
993
0
        !ReadParam(aMsg, aIter, &aResult->mOffset) ||
994
0
        !ReadParam(aMsg, aIter, &aResult->mColor)) {
995
0
      return false;
996
0
    }
997
0
    return true;
998
0
  }
999
};
1000
1001
template<>
1002
struct ParamTraits<mozilla::gfx::ColorMatrixAttributes>
1003
{
1004
  typedef mozilla::gfx::ColorMatrixAttributes paramType;
1005
1006
  static void Write(Message* aMsg, const paramType& aParam)
1007
0
  {
1008
0
    WriteParam(aMsg, aParam.mType);
1009
0
    WriteParam(aMsg, aParam.mValues);
1010
0
  }
1011
1012
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1013
0
  {
1014
0
    if (!ReadParam(aMsg, aIter, &aResult->mType) ||
1015
0
        !ReadParam(aMsg, aIter, &aResult->mValues)) {
1016
0
      return false;
1017
0
    }
1018
0
    return true;
1019
0
  }
1020
};
1021
1022
template<>
1023
struct ParamTraits<mozilla::gfx::ComponentTransferAttributes>
1024
{
1025
  typedef mozilla::gfx::ComponentTransferAttributes paramType;
1026
1027
  static void Write(Message* aMsg, const paramType& aParam)
1028
0
  {
1029
0
    for (int i = 0; i < 4; ++i) {
1030
0
      WriteParam(aMsg, aParam.mTypes[i]);
1031
0
    }
1032
0
    for (int i = 0; i < 4; ++i) {
1033
0
      WriteParam(aMsg, aParam.mValues[i]);
1034
0
    }
1035
0
  }
1036
1037
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1038
0
  {
1039
0
    for (int i = 0; i < 4; ++i) {
1040
0
      if (!ReadParam(aMsg, aIter, &aResult->mTypes[i])) {
1041
0
        return false;
1042
0
      }
1043
0
    }
1044
0
    for (int i = 0; i < 4; ++i) {
1045
0
      if (!ReadParam(aMsg, aIter, &aResult->mValues[i])){
1046
0
        return false;
1047
0
      }
1048
0
    }
1049
0
    return true;
1050
0
  }
1051
};
1052
1053
template<>
1054
struct ParamTraits<mozilla::gfx::ConvolveMatrixAttributes>
1055
{
1056
  typedef mozilla::gfx::ConvolveMatrixAttributes paramType;
1057
1058
  static void Write(Message* aMsg, const paramType& aParam)
1059
0
  {
1060
0
    WriteParam(aMsg, aParam.mKernelSize);
1061
0
    WriteParam(aMsg, aParam.mKernelMatrix);
1062
0
    WriteParam(aMsg, aParam.mDivisor);
1063
0
    WriteParam(aMsg, aParam.mBias);
1064
0
    WriteParam(aMsg, aParam.mTarget);
1065
0
    WriteParam(aMsg, aParam.mEdgeMode);
1066
0
    WriteParam(aMsg, aParam.mKernelUnitLength);
1067
0
    WriteParam(aMsg, aParam.mPreserveAlpha);
1068
0
  }
1069
1070
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1071
0
  {
1072
0
    if (!ReadParam(aMsg, aIter, &aResult->mKernelSize) ||
1073
0
        !ReadParam(aMsg, aIter, &aResult->mKernelMatrix) ||
1074
0
        !ReadParam(aMsg, aIter, &aResult->mDivisor) ||
1075
0
        !ReadParam(aMsg, aIter, &aResult->mBias) ||
1076
0
        !ReadParam(aMsg, aIter, &aResult->mTarget) ||
1077
0
        !ReadParam(aMsg, aIter, &aResult->mEdgeMode) ||
1078
0
        !ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
1079
0
        !ReadParam(aMsg, aIter, &aResult->mPreserveAlpha)) {
1080
0
      return false;
1081
0
    }
1082
0
    return true;
1083
0
  }
1084
};
1085
1086
template<>
1087
struct ParamTraits<mozilla::gfx::DiffuseLightingAttributes>
1088
{
1089
  typedef mozilla::gfx::DiffuseLightingAttributes paramType;
1090
1091
  static void Write(Message* aMsg, const paramType& aParam)
1092
0
  {
1093
0
    WriteParam(aMsg, aParam.mLightType);
1094
0
    WriteParam(aMsg, aParam.mLightValues);
1095
0
    WriteParam(aMsg, aParam.mSurfaceScale);
1096
0
    WriteParam(aMsg, aParam.mKernelUnitLength);
1097
0
    WriteParam(aMsg, aParam.mColor);
1098
0
    WriteParam(aMsg, aParam.mLightingConstant);
1099
0
    WriteParam(aMsg, aParam.mSpecularExponent);
1100
0
  }
1101
1102
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1103
0
  {
1104
0
    if (!ReadParam(aMsg, aIter, &aResult->mLightType) ||
1105
0
        !ReadParam(aMsg, aIter, &aResult->mLightValues) ||
1106
0
        !ReadParam(aMsg, aIter, &aResult->mSurfaceScale) ||
1107
0
        !ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
1108
0
        !ReadParam(aMsg, aIter, &aResult->mColor) ||
1109
0
        !ReadParam(aMsg, aIter, &aResult->mLightingConstant) ||
1110
0
        !ReadParam(aMsg, aIter, &aResult->mSpecularExponent)) {
1111
0
      return false;
1112
0
    }
1113
0
    return true;
1114
0
  }
1115
};
1116
1117
template<>
1118
struct ParamTraits<mozilla::gfx::SpecularLightingAttributes>
1119
{
1120
  typedef mozilla::gfx::SpecularLightingAttributes paramType;
1121
1122
  static void Write(Message* aMsg, const paramType& aParam)
1123
0
  {
1124
0
    WriteParam(aMsg, aParam.mLightType);
1125
0
    WriteParam(aMsg, aParam.mLightValues);
1126
0
    WriteParam(aMsg, aParam.mSurfaceScale);
1127
0
    WriteParam(aMsg, aParam.mKernelUnitLength);
1128
0
    WriteParam(aMsg, aParam.mColor);
1129
0
    WriteParam(aMsg, aParam.mLightingConstant);
1130
0
    WriteParam(aMsg, aParam.mSpecularExponent);
1131
0
  }
1132
1133
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1134
0
  {
1135
0
    if (!ReadParam(aMsg, aIter, &aResult->mLightType) ||
1136
0
        !ReadParam(aMsg, aIter, &aResult->mLightValues) ||
1137
0
        !ReadParam(aMsg, aIter, &aResult->mSurfaceScale) ||
1138
0
        !ReadParam(aMsg, aIter, &aResult->mKernelUnitLength) ||
1139
0
        !ReadParam(aMsg, aIter, &aResult->mColor) ||
1140
0
        !ReadParam(aMsg, aIter, &aResult->mLightingConstant) ||
1141
0
        !ReadParam(aMsg, aIter, &aResult->mSpecularExponent)) {
1142
0
      return false;
1143
0
    }
1144
0
    return true;
1145
0
  }
1146
};
1147
1148
template<>
1149
struct ParamTraits<mozilla::gfx::CompositeAttributes>
1150
{
1151
  typedef mozilla::gfx::CompositeAttributes paramType;
1152
1153
  static void Write(Message* aMsg, const paramType& aParam)
1154
0
  {
1155
0
    WriteParam(aMsg, aParam.mOperator);
1156
0
    WriteParam(aMsg, aParam.mCoefficients);
1157
0
  }
1158
1159
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1160
0
  {
1161
0
    if (!ReadParam(aMsg, aIter, &aResult->mOperator) ||
1162
0
        !ReadParam(aMsg, aIter, &aResult->mCoefficients)) {
1163
0
      return false;
1164
0
    }
1165
0
    return true;
1166
0
  }
1167
};
1168
1169
template <>
1170
struct ParamTraits<mozilla::gfx::FilterPrimitiveDescription>
1171
{
1172
  typedef mozilla::gfx::FilterPrimitiveDescription paramType;
1173
1174
  static void Write(Message* aMsg, const paramType& aParam)
1175
0
  {
1176
0
    WriteParam(aMsg, aParam.PrimitiveSubregion());
1177
0
    WriteParam(aMsg, aParam.FilterSpaceBounds());
1178
0
    WriteParam(aMsg, aParam.IsTainted());
1179
0
    WriteParam(aMsg, aParam.OutputColorSpace());
1180
0
    WriteParam(aMsg, aParam.NumberOfInputs());
1181
0
    for (size_t i = 0; i < aParam.NumberOfInputs(); i++) {
1182
0
      WriteParam(aMsg, aParam.InputPrimitiveIndex(i));
1183
0
      WriteParam(aMsg, aParam.InputColorSpace(i));
1184
0
    }
1185
0
    WriteParam(aMsg, aParam.Attributes());
1186
0
  }
1187
1188
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1189
0
  {
1190
0
    mozilla::gfx::IntRect primitiveSubregion;
1191
0
    mozilla::gfx::IntRect filterSpaceBounds;
1192
0
    bool isTainted = false;
1193
0
    mozilla::gfx::ColorSpace outputColorSpace;
1194
0
    size_t numberOfInputs = 0;
1195
0
    if (!ReadParam(aMsg, aIter, &primitiveSubregion) ||
1196
0
        !ReadParam(aMsg, aIter, &filterSpaceBounds) ||
1197
0
        !ReadParam(aMsg, aIter, &isTainted) ||
1198
0
        !ReadParam(aMsg, aIter, &outputColorSpace) ||
1199
0
        !ReadParam(aMsg, aIter, &numberOfInputs)) {
1200
0
      return false;
1201
0
    }
1202
0
1203
0
    aResult->SetPrimitiveSubregion(primitiveSubregion);
1204
0
    aResult->SetFilterSpaceBounds(filterSpaceBounds);
1205
0
    aResult->SetIsTainted(isTainted);
1206
0
    aResult->SetOutputColorSpace(outputColorSpace);
1207
0
1208
0
    for (size_t i = 0; i < numberOfInputs; i++) {
1209
0
      int32_t inputPrimitiveIndex = 0;
1210
0
      mozilla::gfx::ColorSpace inputColorSpace;
1211
0
      if (!ReadParam(aMsg, aIter, &inputPrimitiveIndex) ||
1212
0
          !ReadParam(aMsg, aIter, &inputColorSpace)) {
1213
0
        return false;
1214
0
      }
1215
0
      aResult->SetInputPrimitive(i, inputPrimitiveIndex);
1216
0
      aResult->SetInputColorSpace(i, inputColorSpace);
1217
0
    }
1218
0
1219
0
    return ReadParam(aMsg, aIter, &aResult->Attributes());
1220
0
  }
1221
};
1222
1223
template <>
1224
struct ParamTraits<mozilla::gfx::FilterDescription>
1225
{
1226
  typedef mozilla::gfx::FilterDescription paramType;
1227
1228
  static void Write(Message* aMsg, const paramType& aParam)
1229
0
  {
1230
0
    WriteParam(aMsg, aParam.mPrimitives);
1231
0
  }
1232
1233
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
1234
0
  {
1235
0
    return (ReadParam(aMsg, aIter, &aResult->mPrimitives));
1236
0
  }
1237
};
1238
1239
template <>
1240
struct ParamTraits<mozilla::gfx::Glyph>
1241
{
1242
  typedef mozilla::gfx::Glyph paramType;
1243
0
  static void Write(Message* aMsg, const paramType& aParam) {
1244
0
    WriteParam(aMsg, aParam.mIndex);
1245
0
    WriteParam(aMsg, aParam.mPosition);
1246
0
  }
1247
1248
0
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
1249
0
    return (ReadParam(aMsg, aIter, &aResult->mIndex) &&
1250
0
            ReadParam(aMsg, aIter, &aResult->mPosition)
1251
0
      );
1252
0
  }
1253
};
1254
1255
template<typename T, size_t Length>
1256
struct ParamTraits<mozilla::Array<T, Length>>
1257
{
1258
  typedef mozilla::Array<T, Length> paramType;
1259
  static void Write(Message* aMsg, const paramType& aParam) {
1260
    for (size_t i = 0; i < Length; i++) {
1261
      WriteParam(aMsg, aParam[i]);
1262
    }
1263
  }
1264
1265
  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
1266
    for (size_t i = 0; i < Length; i++) {
1267
      if (!ReadParam<T>(aMsg, aIter, &aResult->operator[](i))) {
1268
        return false;
1269
      }
1270
    }
1271
    return true;
1272
  }
1273
};
1274
1275
template <>
1276
struct ParamTraits<mozilla::gfx::CompositorHitTestInfo>
1277
  : public BitFlagsEnumSerializer<mozilla::gfx::CompositorHitTestInfo,
1278
                                  mozilla::gfx::CompositorHitTestInfo::ALL_BITS>
1279
{
1280
};
1281
1282
} /* namespace IPC */
1283
1284
#endif /* __GFXMESSAGEUTILS_H__ */