Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/* Generated with cbindgen:0.13.1 */
6
7
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
8
* To generate this file:
9
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
10
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
11
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
12
*/
13
14
#include <cstdarg>
15
#include <cstdint>
16
#include <cstdlib>
17
#include <new>
18
19
namespace mozilla {
20
namespace wr {
21
22
static const uintptr_t GlyphCache_DEFAULT_MAX_BYTES_USED = ((6 * 1024) * 1024);
23
24
/// Whether a border should be antialiased.
25
enum class AntialiasBorder {
26
No = 0,
27
Yes,
28
/// Must be last for serialization purposes
29
Sentinel,
30
};
31
32
enum class BorderStyle : uint32_t {
33
None = 0,
34
Solid = 1,
35
Double = 2,
36
Dotted = 3,
37
Dashed = 4,
38
Hidden = 5,
39
Groove = 6,
40
Ridge = 7,
41
Inset = 8,
42
Outset = 9,
43
/// Must be last for serialization purposes
44
Sentinel,
45
};
46
47
enum class BoxShadowClipMode : uint8_t {
48
Outset = 0,
49
Inset = 1,
50
/// Must be last for serialization purposes
51
Sentinel,
52
};
53
54
/// A stage of the rendering pipeline.
55
enum class Checkpoint : uint32_t {
56
///
57
SceneBuilt,
58
///
59
FrameBuilt,
60
///
61
FrameTexturesUpdated,
62
///
63
FrameRendered,
64
/// NotificationRequests get notified with this if they get dropped without having been
65
/// notified. This provides the guarantee that if a request is created it will get notified.
66
TransactionDropped,
67
/// Must be last for serialization purposes
68
Sentinel,
69
};
70
71
enum class ClipMode {
72
Clip,
73
ClipOut,
74
/// Must be last for serialization purposes
75
Sentinel,
76
};
77
78
/// Specifies the color depth of an image. Currently only used for YUV images.
79
enum class ColorDepth : uint8_t {
80
/// 8 bits image (most common)
81
Color8,
82
/// 10 bits image
83
Color10,
84
/// 12 bits image
85
Color12,
86
/// 16 bits image
87
Color16,
88
/// Must be last for serialization purposes
89
Sentinel,
90
};
91
92
enum class ColorRange : uint8_t {
93
Limited = 0,
94
Full = 1,
95
/// Must be last for serialization purposes
96
Sentinel,
97
};
98
99
enum class ComponentTransferFuncType : uint8_t {
100
Identity = 0,
101
Table = 1,
102
Discrete = 2,
103
Linear = 3,
104
Gamma = 4,
105
/// Must be last for serialization purposes
106
Sentinel,
107
};
108
109
enum class ExtendMode : uint8_t {
110
Clamp,
111
Repeat,
112
/// Must be last for serialization purposes
113
Sentinel,
114
};
115
116
#if !(defined(XP_MACOSX) || defined(XP_WIN))
117
enum class FontHinting : uint8_t {
118
None,
119
Mono,
120
Light,
121
Normal,
122
LCD,
123
/// Must be last for serialization purposes
124
Sentinel,
125
};
126
#endif
127
128
#if !(defined(XP_MACOSX) || defined(XP_WIN))
129
enum class FontLCDFilter : uint8_t {
130
None,
131
Default,
132
Light,
133
Legacy,
134
/// Must be last for serialization purposes
135
Sentinel,
136
};
137
#endif
138
139
enum class FontRenderMode : uint8_t {
140
Mono = 0,
141
Alpha,
142
Subpixel,
143
/// Must be last for serialization purposes
144
Sentinel,
145
};
146
147
/// Specifies the format of a series of pixels, in driver terms.
148
enum class ImageFormat : uint8_t {
149
/// One-channel, byte storage. The "red" doesn't map to the color
150
/// red per se, and is just the way that OpenGL has historically referred
151
/// to single-channel buffers.
152
R8 = 1,
153
/// One-channel, short storage
154
R16 = 2,
155
/// Four channels, byte storage.
156
BGRA8 = 3,
157
/// Four channels, float storage.
158
RGBAF32 = 4,
159
/// Two-channels, byte storage. Similar to `R8`, this just means
160
/// "two channels" rather than "red and green".
161
RG8 = 5,
162
/// Two-channels, byte storage. Similar to `R16`, this just means
163
/// "two channels" rather than "red and green".
164
RG16 = 6,
165
/// Four channels, signed integer storage.
166
RGBAI32 = 7,
167
/// Four channels, byte storage.
168
RGBA8 = 8,
169
/// Must be last for serialization purposes
170
Sentinel,
171
};
172
173
enum class ImageRendering : uint8_t {
174
Auto = 0,
175
CrispEdges = 1,
176
Pixelated = 2,
177
/// Must be last for serialization purposes
178
Sentinel,
179
};
180
181
enum class LineOrientation : uint8_t {
182
Vertical,
183
Horizontal,
184
/// Must be last for serialization purposes
185
Sentinel,
186
};
187
188
enum class LineStyle : uint8_t {
189
Solid,
190
Dotted,
191
Dashed,
192
Wavy,
193
/// Must be last for serialization purposes
194
Sentinel,
195
};
196
197
enum class MixBlendMode : uint8_t {
198
Normal = 0,
199
Multiply = 1,
200
Screen = 2,
201
Overlay = 3,
202
Darken = 4,
203
Lighten = 5,
204
ColorDodge = 6,
205
ColorBurn = 7,
206
HardLight = 8,
207
SoftLight = 9,
208
Difference = 10,
209
Exclusion = 11,
210
Hue = 12,
211
Saturation = 13,
212
Color = 14,
213
Luminosity = 15,
214
/// Must be last for serialization purposes
215
Sentinel,
216
};
217
218
/// Used to indicate if an image is opaque, or has an alpha channel.
219
enum class OpacityType : uint8_t {
220
Opaque = 0,
221
HasAlphaChannel = 1,
222
/// Must be last for serialization purposes
223
Sentinel,
224
};
225
226
enum class RepeatMode : uint8_t {
227
Stretch,
228
Repeat,
229
Round,
230
Space,
231
/// Must be last for serialization purposes
232
Sentinel,
233
};
234
235
enum class TelemetryProbe {
236
SceneBuildTime = 0,
237
SceneSwapTime = 1,
238
FrameBuildTime = 2,
239
/// Must be last for serialization purposes
240
Sentinel,
241
};
242
243
/// Specifies the type of texture target in driver terms.
244
enum class TextureTarget : uint8_t {
245
/// Standard texture. This maps to GL_TEXTURE_2D in OpenGL.
246
Default = 0,
247
/// Array texture. This maps to GL_TEXTURE_2D_ARRAY in OpenGL. See
249
/// on Array textures.
250
Array = 1,
251
/// Rectangle texture. This maps to GL_TEXTURE_RECTANGLE in OpenGL. This
252
/// is similar to a standard texture, with a few subtle differences
253
/// (no mipmaps, non-power-of-two dimensions, different coordinate space)
254
/// that make it useful for representing the kinds of textures we use
256
/// for background on Rectangle textures.
257
Rect = 2,
258
/// External texture. This maps to GL_TEXTURE_EXTERNAL_OES in OpenGL, which
259
/// is an extension. This is used for image formats that OpenGL doesn't
260
/// understand, particularly YUV. See
262
External = 3,
263
/// Must be last for serialization purposes
264
Sentinel,
265
};
266
267
enum class TransformStyle : uint8_t {
268
Flat = 0,
269
Preserve3D = 1,
270
/// Must be last for serialization purposes
271
Sentinel,
272
};
273
274
enum class WrAnimationType : uint32_t {
275
Transform = 0,
276
Opacity = 1,
277
BackgroundColor = 2,
278
/// Must be last for serialization purposes
279
Sentinel,
280
};
281
282
enum class WrExternalImageType : uint32_t {
283
RawData,
284
NativeTexture,
285
Invalid,
286
/// Must be last for serialization purposes
287
Sentinel,
288
};
289
290
enum class WrReferenceFrameKind : uint8_t {
291
Transform,
292
Perspective,
293
/// Must be last for serialization purposes
294
Sentinel,
295
};
296
297
enum class YuvColorSpace : uint8_t {
298
Rec601 = 0,
299
Rec709 = 1,
300
Rec2020 = 2,
301
/// Must be last for serialization purposes
302
Sentinel,
303
};
304
305
template<typename T>
306
struct Arc;
307
308
/// Features of the batch that, if not requested, may allow a fast-path.
309
///
310
/// Rather than breaking batches when primitives request different features,
311
/// we always request the minimum amount of features to satisfy all items in
312
/// the batch.
313
/// The goal is to let the renderer be optionally select more specialized
314
/// versions of a shader if the batch doesn't require code certain code paths.
315
/// Not all shaders necessarily implement all of these features.
316
struct BatchFeatures;
317
318
/// A set of flags describing why a picture may need a backing surface.
319
struct BlitReason;
320
321
/// Flags that define how the common brush shader
322
/// code should process this instance.
323
struct BrushFlags;
324
325
/// Bit flags for WR stages to store in a capture.
326
struct CaptureBits;
327
328
/// Mask for clearing caches in debug commands.
329
struct ClearCache;
330
331
struct ClipNodeFlags;
332
333
/// A set of flags describing why a picture may need a backing surface.
334
struct ClusterFlags;
335
336
struct Device;
337
338
/// Geometry in the coordinate system of the render target (screen or intermediate
339
/// surface) in physical pixels.
340
struct DevicePixel;
341
342
struct DocumentHandle;
343
344
/// Each bit of the edge AA mask is:
345
/// 0, when the edge of the primitive needs to be considered for AA
346
/// 1, when the edge of the segment needs to be considered for AA
347
///
348
/// *Note*: the bit values have to match the shader logic in
349
/// `write_transform_vertex()` function.
350
struct EdgeAaSegmentMask;
351
352
///
353
struct HitTestFlags;
354
355
/// Various flags that are part of an image descriptor.
356
struct ImageDescriptorFlags;
357
358
struct ItemFlags;
359
360
/// Geometry in a stacking context's local coordinate space (logical pixels).
361
struct LayoutPixel;
362
363
/// A set of bitflags that can be set in the visibility information
364
/// for a primitive instance. This can be used to control how primitives
365
/// are treated during batching.
366
struct PrimitiveVisibilityFlags;
367
368
/// The renderer is responsible for submitting to the GPU the work prepared by the
369
/// RenderBackend.
370
///
371
/// We have a separate `Renderer` instance for each instance of WebRender (generally
372
/// one per OS window), and all instances share the same thread.
373
struct Renderer;
374
375
/// Flags that control how shaders are pre-cached, if at all.
376
struct ShaderPrecacheFlags;
377
378
/// Slice flags
379
struct SliceFlags;
380
381
struct TextureFlags;
382
383
/// Unit for tile coordinates.
384
struct TileCoordinate;
385
386
/// Represents the work associated to a transaction before scene building.
387
struct Transaction;
388
389
template<typename T>
390
struct Vec;
391
392
/// Geometry in the document's coordinate space (logical pixels).
393
struct WorldPixel;
394
395
struct WrProgramCache;
396
397
struct WrShaders;
398
399
struct WrState;
400
401
struct WrThreadPool;
402
403
/// ID namespaces uniquely identify different users of WebRender's API.
404
///
405
/// For example in Gecko each content process uses a separate id namespace.
406
struct IdNamespace {
407
uint32_t mHandle;
408
409
bool operator==(const IdNamespace& aOther) const {
410
return mHandle == aOther.mHandle;
411
}
412
bool operator!=(const IdNamespace& aOther) const {
413
return mHandle != aOther.mHandle;
414
}
415
bool operator<(const IdNamespace& aOther) const {
416
return mHandle < aOther.mHandle;
417
}
418
bool operator<=(const IdNamespace& aOther) const {
419
return mHandle <= aOther.mHandle;
420
}
421
};
422
423
struct FontInstanceKey {
424
IdNamespace mNamespace;
425
uint32_t mHandle;
426
427
bool operator==(const FontInstanceKey& aOther) const {
428
return mNamespace == aOther.mNamespace &&
429
mHandle == aOther.mHandle;
430
}
431
};
432
433
using WrFontInstanceKey = FontInstanceKey;
434
435
struct FontKey {
436
IdNamespace mNamespace;
437
uint32_t mHandle;
438
439
bool operator==(const FontKey& aOther) const {
440
return mNamespace == aOther.mNamespace &&
441
mHandle == aOther.mHandle;
442
}
443
};
444
445
using WrFontKey = FontKey;
446
447
struct FontInstanceFlags {
448
uint32_t bits;
449
450
explicit operator bool() const {
451
return !!bits;
452
}
453
FontInstanceFlags operator~() const {
454
return {static_cast<decltype(bits)>(~bits)};
455
}
456
FontInstanceFlags operator|(const FontInstanceFlags& aOther) const {
457
return {static_cast<decltype(bits)>(this->bits | aOther.bits)};
458
}
459
FontInstanceFlags& operator|=(const FontInstanceFlags& aOther) {
460
*this = (*this | aOther);
461
return *this;
462
}
463
FontInstanceFlags operator&(const FontInstanceFlags& aOther) const {
464
return {static_cast<decltype(bits)>(this->bits & aOther.bits)};
465
}
466
FontInstanceFlags& operator&=(const FontInstanceFlags& aOther) {
467
*this = (*this & aOther);
468
return *this;
469
}
470
FontInstanceFlags operator^(const FontInstanceFlags& aOther) const {
471
return {static_cast<decltype(bits)>(this->bits ^ aOther.bits)};
472
}
473
FontInstanceFlags& operator^=(const FontInstanceFlags& aOther) {
474
*this = (*this ^ aOther);
475
return *this;
476
}
477
bool operator==(const FontInstanceFlags& aOther) const {
478
return bits == aOther.bits;
479
}
480
static const FontInstanceFlags SYNTHETIC_BOLD;
481
static const FontInstanceFlags EMBEDDED_BITMAPS;
482
static const FontInstanceFlags SUBPIXEL_BGR;
483
static const FontInstanceFlags TRANSPOSE;
484
static const FontInstanceFlags FLIP_X;
485
static const FontInstanceFlags FLIP_Y;
486
static const FontInstanceFlags SUBPIXEL_POSITION;
487
static const FontInstanceFlags VERTICAL;
488
static const FontInstanceFlags FORCE_GDI;
489
static const FontInstanceFlags FORCE_SYMMETRIC;
490
static const FontInstanceFlags NO_SYMMETRIC;
491
static const FontInstanceFlags FONT_SMOOTHING;
492
static const FontInstanceFlags FORCE_AUTOHINT;
493
static const FontInstanceFlags NO_AUTOHINT;
494
static const FontInstanceFlags VERTICAL_LAYOUT;
495
static const FontInstanceFlags LCD_VERTICAL;
496
};
497
inline const FontInstanceFlags FontInstanceFlags::SYNTHETIC_BOLD = FontInstanceFlags{ /* .bits = */ (1 << 1) };
498
inline const FontInstanceFlags FontInstanceFlags::EMBEDDED_BITMAPS = FontInstanceFlags{ /* .bits = */ (1 << 2) };
499
inline const FontInstanceFlags FontInstanceFlags::SUBPIXEL_BGR = FontInstanceFlags{ /* .bits = */ (1 << 3) };
500
inline const FontInstanceFlags FontInstanceFlags::TRANSPOSE = FontInstanceFlags{ /* .bits = */ (1 << 4) };
501
inline const FontInstanceFlags FontInstanceFlags::FLIP_X = FontInstanceFlags{ /* .bits = */ (1 << 5) };
502
inline const FontInstanceFlags FontInstanceFlags::FLIP_Y = FontInstanceFlags{ /* .bits = */ (1 << 6) };
503
inline const FontInstanceFlags FontInstanceFlags::SUBPIXEL_POSITION = FontInstanceFlags{ /* .bits = */ (1 << 7) };
504
inline const FontInstanceFlags FontInstanceFlags::VERTICAL = FontInstanceFlags{ /* .bits = */ (1 << 8) };
505
inline const FontInstanceFlags FontInstanceFlags::FORCE_GDI = FontInstanceFlags{ /* .bits = */ (1 << 16) };
506
inline const FontInstanceFlags FontInstanceFlags::FORCE_SYMMETRIC = FontInstanceFlags{ /* .bits = */ (1 << 17) };
507
inline const FontInstanceFlags FontInstanceFlags::NO_SYMMETRIC = FontInstanceFlags{ /* .bits = */ (1 << 18) };
508
inline const FontInstanceFlags FontInstanceFlags::FONT_SMOOTHING = FontInstanceFlags{ /* .bits = */ (1 << 16) };
509
inline const FontInstanceFlags FontInstanceFlags::FORCE_AUTOHINT = FontInstanceFlags{ /* .bits = */ (1 << 16) };
510
inline const FontInstanceFlags FontInstanceFlags::NO_AUTOHINT = FontInstanceFlags{ /* .bits = */ (1 << 17) };
511
inline const FontInstanceFlags FontInstanceFlags::VERTICAL_LAYOUT = FontInstanceFlags{ /* .bits = */ (1 << 18) };
512
inline const FontInstanceFlags FontInstanceFlags::LCD_VERTICAL = FontInstanceFlags{ /* .bits = */ (1 << 19) };
513
514
/// Represents RGBA screen colors with one byte per channel.
515
///
516
/// If the alpha value `a` is 255 the color is opaque.
517
struct ColorU {
518
uint8_t r;
519
uint8_t g;
520
uint8_t b;
521
uint8_t a;
522
523
bool operator==(const ColorU& aOther) const {
524
return r == aOther.r &&
525
g == aOther.g &&
526
b == aOther.b &&
527
a == aOther.a;
528
}
529
};
530
531
struct SyntheticItalics {
532
int16_t angle;
533
534
bool operator==(const SyntheticItalics& aOther) const {
535
return angle == aOther.angle;
536
}
537
static const float ANGLE_SCALE;
538
};
539
inline const float SyntheticItalics::ANGLE_SCALE = 256.0;
540
541
struct FontInstanceOptions {
542
FontRenderMode render_mode;
543
FontInstanceFlags flags;
544
/// When bg_color.a is != 0 and render_mode is FontRenderMode::Subpixel,
545
/// the text will be rendered with bg_color.r/g/b as an opaque estimated
546
/// background color.
547
ColorU bg_color;
548
SyntheticItalics synthetic_italics;
549
550
bool operator==(const FontInstanceOptions& aOther) const {
551
return render_mode == aOther.render_mode &&
552
flags == aOther.flags &&
553
bg_color == aOther.bg_color &&
554
synthetic_italics == aOther.synthetic_italics;
555
}
556
};
557
558
#if defined(XP_WIN)
559
struct FontInstancePlatformOptions {
560
uint16_t gamma;
561
uint8_t contrast;
562
uint8_t cleartype_level;
563
564
bool operator==(const FontInstancePlatformOptions& aOther) const {
565
return gamma == aOther.gamma &&
566
contrast == aOther.contrast &&
567
cleartype_level == aOther.cleartype_level;
568
}
569
};
570
#endif
571
572
#if defined(XP_MACOSX)
573
struct FontInstancePlatformOptions {
574
uint32_t unused;
575
576
bool operator==(const FontInstancePlatformOptions& aOther) const {
577
return unused == aOther.unused;
578
}
579
};
580
#endif
581
582
#if !(defined(XP_MACOSX) || defined(XP_WIN))
583
struct FontInstancePlatformOptions {
584
FontLCDFilter lcd_filter;
585
FontHinting hinting;
586
587
bool operator==(const FontInstancePlatformOptions& aOther) const {
588
return lcd_filter == aOther.lcd_filter &&
589
hinting == aOther.hinting;
590
}
591
};
592
#endif
593
594
struct FontVariation {
595
uint32_t tag;
596
float value;
597
598
bool operator==(const FontVariation& aOther) const {
599
return tag == aOther.tag &&
600
value == aOther.value;
601
}
602
};
603
604
using VecU8 = Vec<uint8_t>;
605
606
using ArcVecU8 = Arc<VecU8>;
607
608
using WrIdNamespace = IdNamespace;
609
610
struct WrWindowId {
611
uint64_t mHandle;
612
613
bool operator==(const WrWindowId& aOther) const {
614
return mHandle == aOther.mHandle;
615
}
616
bool operator<(const WrWindowId& aOther) const {
617
return mHandle < aOther.mHandle;
618
}
619
bool operator<=(const WrWindowId& aOther) const {
620
return mHandle <= aOther.mHandle;
621
}
622
};
623
624
/// This type carries no valuable semantics for WR. However, it reflects the fact that
625
/// clients (Servo) may generate pipelines by different semi-independent sources.
626
/// These pipelines still belong to the same `IdNamespace` and the same `DocumentId`.
627
/// Having this extra Id field enables them to generate `PipelineId` without collision.
628
using PipelineSourceId = uint32_t;
629
630
/// From the point of view of WR, `PipelineId` is completely opaque and generic as long as
631
/// it's clonable, serializable, comparable, and hashable.
632
struct PipelineId {
633
PipelineSourceId mNamespace;
634
uint32_t mHandle;
635
636
bool operator==(const PipelineId& aOther) const {
637
return mNamespace == aOther.mNamespace &&
638
mHandle == aOther.mHandle;
639
}
640
};
641
642
using WrPipelineId = PipelineId;
643
644
/// A key uniquely identifying a WebRender document.
645
///
646
/// Instances can manage one or several documents (using the same render backend thread).
647
/// Each document will internally correspond to a single scene, and scenes are made of
648
/// one or several pipelines.
649
struct DocumentId {
650
///
651
IdNamespace mNamespace;
652
///
653
uint32_t mHandle;
654
655
bool operator==(const DocumentId& aOther) const {
656
return mNamespace == aOther.mNamespace &&
657
mHandle == aOther.mHandle;
658
}
659
};
660
661
using WrDocumentId = DocumentId;
662
663
/// An epoch identifies the state of a pipeline in time.
664
///
665
/// This is mostly used as a synchronization mechanism to observe how/when particular pipeline
666
/// updates propagate through WebRender and are applied at various stages.
667
struct Epoch {
668
uint32_t mHandle;
669
670
bool operator==(const Epoch& aOther) const {
671
return mHandle == aOther.mHandle;
672
}
673
bool operator!=(const Epoch& aOther) const {
674
return mHandle != aOther.mHandle;
675
}
676
bool operator<(const Epoch& aOther) const {
677
return mHandle < aOther.mHandle;
678
}
679
bool operator<=(const Epoch& aOther) const {
680
return mHandle <= aOther.mHandle;
681
}
682
};
683
684
using WrEpoch = Epoch;
685
686
struct WrPipelineEpoch {
687
WrPipelineId pipeline_id;
688
WrDocumentId document_id;
689
WrEpoch epoch;
690
691
bool operator==(const WrPipelineEpoch& aOther) const {
692
return pipeline_id == aOther.pipeline_id &&
693
document_id == aOther.document_id &&
694
epoch == aOther.epoch;
695
}
696
};
697
698
struct WrRemovedPipeline {
699
WrPipelineId pipeline_id;
700
WrDocumentId document_id;
701
702
bool operator==(const WrRemovedPipeline& aOther) const {
703
return pipeline_id == aOther.pipeline_id &&
704
document_id == aOther.document_id;
705
}
706
};
707
708
struct WrPipelineInfo {
709
/// This contains an entry for each pipeline that was rendered, along with
710
/// the epoch at which it was rendered. Rendered pipelines include the root
711
/// pipeline and any other pipelines that were reachable via IFrame display
712
/// items from the root pipeline.
713
nsTArray<WrPipelineEpoch> epochs;
714
/// This contains an entry for each pipeline that was removed during the
715
/// last transaction. These pipelines would have been explicitly removed by
716
/// calling remove_pipeline on the transaction object; the pipeline showing
717
/// up in this array means that the data structures have been torn down on
718
/// the webrender side, and so any remaining data structures on the caller
719
/// side can now be torn down also.
720
nsTArray<WrRemovedPipeline> removed_pipelines;
721
722
bool operator==(const WrPipelineInfo& aOther) const {
723
return epochs == aOther.epochs &&
724
removed_pipelines == aOther.removed_pipelines;
725
}
726
};
727
728
struct WrPipelineIdAndEpoch {
729
WrPipelineId pipeline_id;
730
WrEpoch epoch;
731
732
bool operator==(const WrPipelineIdAndEpoch& aOther) const {
733
return pipeline_id == aOther.pipeline_id &&
734
epoch == aOther.epoch;
735
}
736
};
737
738
using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
739
740
/// Memory report for interning-related data structures.
741
struct InterningMemoryReport {
742
///
743
InternerSubReport interners;
744
///
745
InternerSubReport data_stores;
746
};
747
748
/// Collection of heap sizes, in bytes.
749
struct MemoryReport {
750
uintptr_t clip_stores;
751
uintptr_t gpu_cache_metadata;
752
uintptr_t gpu_cache_cpu_mirror;
753
uintptr_t render_tasks;
754
uintptr_t hit_testers;
755
uintptr_t fonts;
756
uintptr_t images;
757
uintptr_t rasterized_blobs;
758
uintptr_t shader_cache;
759
InterningMemoryReport interning;
760
uintptr_t gpu_cache_textures;
761
uintptr_t vertex_data_textures;
762
uintptr_t render_target_textures;
763
uintptr_t texture_cache_textures;
764
uintptr_t depth_target_textures;
765
uintptr_t swap_chain;
766
};
767
768
/// A 2d size tagged with a unit.
769
template<typename T, typename U>
770
struct Size2D {
771
T width;
772
T height;
773
774
bool operator==(const Size2D& aOther) const {
775
return width == aOther.width &&
776
height == aOther.height;
777
}
778
};
779
780
using DeviceIntSize = Size2D<int32_t, DevicePixel>;
781
782
using LayoutSize = Size2D<float, LayoutPixel>;
783
784
/// Describes the memory layout of a display list.
785
///
786
/// A display list consists of some number of display list items, followed by a number of display
787
/// items.
788
struct BuiltDisplayListDescriptor {
789
/// The first IPC time stamp: before any work has been done
790
uint64_t builder_start_time;
791
/// The second IPC time stamp: after serialization
792
uint64_t builder_finish_time;
793
/// The third IPC time stamp: just before sending
794
uint64_t send_start_time;
795
/// The amount of clipping nodes created while building this display list.
796
uintptr_t total_clip_nodes;
797
/// The amount of spatial nodes created while building this display list.
798
uintptr_t total_spatial_nodes;
799
/// The size of the cache for this display list.
800
uintptr_t cache_size;
801
/// The offset for additional display list data.
802
uintptr_t extra_data_offset;
803
804
bool operator==(const BuiltDisplayListDescriptor& aOther) const {
805
return builder_start_time == aOther.builder_start_time &&
806
builder_finish_time == aOther.builder_finish_time &&
807
send_start_time == aOther.send_start_time &&
808
total_clip_nodes == aOther.total_clip_nodes &&
809
total_spatial_nodes == aOther.total_spatial_nodes &&
810
cache_size == aOther.cache_size &&
811
extra_data_offset == aOther.extra_data_offset;
812
}
813
};
814
815
struct WrVecU8 {
816
uint8_t *data;
817
uintptr_t length;
818
uintptr_t capacity;
819
820
bool operator==(const WrVecU8& aOther) const {
821
return data == aOther.data &&
822
length == aOther.length &&
823
capacity == aOther.capacity;
824
}
825
};
826
827
/// A 2d Point tagged with a unit.
828
template<typename T, typename U>
829
struct Point2D {
830
T x;
831
T y;
832
833
bool operator==(const Point2D& aOther) const {
834
return x == aOther.x &&
835
y == aOther.y;
836
}
837
};
838
839
using WorldPoint = Point2D<float, WorldPixel>;
840
841
/// Flags to enable/disable various builtin debugging tools.
842
struct DebugFlags {
843
uint32_t bits;
844
845
explicit operator bool() const {
846
return !!bits;
847
}
848
DebugFlags operator~() const {
849
return {static_cast<decltype(bits)>(~bits)};
850
}
851
DebugFlags operator|(const DebugFlags& aOther) const {
852
return {static_cast<decltype(bits)>(this->bits | aOther.bits)};
853
}
854
DebugFlags& operator|=(const DebugFlags& aOther) {
855
*this = (*this | aOther);
856
return *this;
857
}
858
DebugFlags operator&(const DebugFlags& aOther) const {
859
return {static_cast<decltype(bits)>(this->bits & aOther.bits)};
860
}
861
DebugFlags& operator&=(const DebugFlags& aOther) {
862
*this = (*this & aOther);
863
return *this;
864
}
865
DebugFlags operator^(const DebugFlags& aOther) const {
866
return {static_cast<decltype(bits)>(this->bits ^ aOther.bits)};
867
}
868
DebugFlags& operator^=(const DebugFlags& aOther) {
869
*this = (*this ^ aOther);
870
return *this;
871
}
872
bool operator==(const DebugFlags& aOther) const {
873
return bits == aOther.bits;
874
}
875
static const DebugFlags PROFILER_DBG;
876
static const DebugFlags RENDER_TARGET_DBG;
877
static const DebugFlags TEXTURE_CACHE_DBG;
878
static const DebugFlags GPU_TIME_QUERIES;
879
static const DebugFlags GPU_SAMPLE_QUERIES;
880
static const DebugFlags DISABLE_BATCHING;
881
static const DebugFlags EPOCHS;
882
static const DebugFlags COMPACT_PROFILER;
883
static const DebugFlags ECHO_DRIVER_MESSAGES;
884
static const DebugFlags NEW_FRAME_INDICATOR;
885
static const DebugFlags NEW_SCENE_INDICATOR;
886
static const DebugFlags SHOW_OVERDRAW;
887
static const DebugFlags GPU_CACHE_DBG;
888
static const DebugFlags SLOW_FRAME_INDICATOR;
889
static const DebugFlags TEXTURE_CACHE_DBG_CLEAR_EVICTED;
890
static const DebugFlags PICTURE_CACHING_DBG;
891
static const DebugFlags PRIMITIVE_DBG;
892
static const DebugFlags ZOOM_DBG;
893
static const DebugFlags SMALL_SCREEN;
894
static const DebugFlags DISABLE_OPAQUE_PASS;
895
static const DebugFlags DISABLE_ALPHA_PASS;
896
static const DebugFlags DISABLE_CLIP_MASKS;
897
static const DebugFlags DISABLE_TEXT_PRIMS;
898
static const DebugFlags DISABLE_GRADIENT_PRIMS;
899
static const DebugFlags OBSCURE_IMAGES;
900
static const DebugFlags GLYPH_FLASHING;
901
static const DebugFlags SMART_PROFILER;
902
static const DebugFlags DISABLE_PICTURE_CACHING;
903
static const DebugFlags INVALIDATION_DBG;
904
static const DebugFlags TILE_CACHE_LOGGING_DBG;
905
static const DebugFlags DISABLE_RASTER_ROOT_SCALING;
906
};
907
inline const DebugFlags DebugFlags::PROFILER_DBG = DebugFlags{ /* .bits = */ (1 << 0) };
908
inline const DebugFlags DebugFlags::RENDER_TARGET_DBG = DebugFlags{ /* .bits = */ (1 << 1) };
909
inline const DebugFlags DebugFlags::TEXTURE_CACHE_DBG = DebugFlags{ /* .bits = */ (1 << 2) };
910
inline const DebugFlags DebugFlags::GPU_TIME_QUERIES = DebugFlags{ /* .bits = */ (1 << 3) };
911
inline const DebugFlags DebugFlags::GPU_SAMPLE_QUERIES = DebugFlags{ /* .bits = */ (1 << 4) };
912
inline const DebugFlags DebugFlags::DISABLE_BATCHING = DebugFlags{ /* .bits = */ (1 << 5) };
913
inline const DebugFlags DebugFlags::EPOCHS = DebugFlags{ /* .bits = */ (1 << 6) };
914
inline const DebugFlags DebugFlags::COMPACT_PROFILER = DebugFlags{ /* .bits = */ (1 << 7) };
915
inline const DebugFlags DebugFlags::ECHO_DRIVER_MESSAGES = DebugFlags{ /* .bits = */ (1 << 8) };
916
inline const DebugFlags DebugFlags::NEW_FRAME_INDICATOR = DebugFlags{ /* .bits = */ (1 << 9) };
917
inline const DebugFlags DebugFlags::NEW_SCENE_INDICATOR = DebugFlags{ /* .bits = */ (1 << 10) };
918
inline const DebugFlags DebugFlags::SHOW_OVERDRAW = DebugFlags{ /* .bits = */ (1 << 11) };
919
inline const DebugFlags DebugFlags::GPU_CACHE_DBG = DebugFlags{ /* .bits = */ (1 << 12) };
920
inline const DebugFlags DebugFlags::SLOW_FRAME_INDICATOR = DebugFlags{ /* .bits = */ (1 << 13) };
921
inline const DebugFlags DebugFlags::TEXTURE_CACHE_DBG_CLEAR_EVICTED = DebugFlags{ /* .bits = */ (1 << 14) };
922
inline const DebugFlags DebugFlags::PICTURE_CACHING_DBG = DebugFlags{ /* .bits = */ (1 << 15) };
923
inline const DebugFlags DebugFlags::PRIMITIVE_DBG = DebugFlags{ /* .bits = */ (1 << 16) };
924
inline const DebugFlags DebugFlags::ZOOM_DBG = DebugFlags{ /* .bits = */ (1 << 17) };
925
inline const DebugFlags DebugFlags::SMALL_SCREEN = DebugFlags{ /* .bits = */ (1 << 18) };
926
inline const DebugFlags DebugFlags::DISABLE_OPAQUE_PASS = DebugFlags{ /* .bits = */ (1 << 19) };
927
inline const DebugFlags DebugFlags::DISABLE_ALPHA_PASS = DebugFlags{ /* .bits = */ (1 << 20) };
928
inline const DebugFlags DebugFlags::DISABLE_CLIP_MASKS = DebugFlags{ /* .bits = */ (1 << 21) };
929
inline const DebugFlags DebugFlags::DISABLE_TEXT_PRIMS = DebugFlags{ /* .bits = */ (1 << 22) };
930
inline const DebugFlags DebugFlags::DISABLE_GRADIENT_PRIMS = DebugFlags{ /* .bits = */ (1 << 23) };
931
inline const DebugFlags DebugFlags::OBSCURE_IMAGES = DebugFlags{ /* .bits = */ (1 << 24) };
932
inline const DebugFlags DebugFlags::GLYPH_FLASHING = DebugFlags{ /* .bits = */ (1 << 25) };
933
inline const DebugFlags DebugFlags::SMART_PROFILER = DebugFlags{ /* .bits = */ (1 << 26) };
934
inline const DebugFlags DebugFlags::DISABLE_PICTURE_CACHING = DebugFlags{ /* .bits = */ (1 << 27) };
935
inline const DebugFlags DebugFlags::INVALIDATION_DBG = DebugFlags{ /* .bits = */ (1 << 28) };
936
inline const DebugFlags DebugFlags::TILE_CACHE_LOGGING_DBG = DebugFlags{ /* .bits = */ (1 << 29) };
937
inline const DebugFlags DebugFlags::DISABLE_RASTER_ROOT_SCALING = DebugFlags{ /* .bits = */ (1 << 30) };
938
939
/// An arbitrary identifier for a native (OS compositor) surface
940
struct NativeSurfaceId {
941
uint64_t _0;
942
943
bool operator==(const NativeSurfaceId& aOther) const {
944
return _0 == aOther._0;
945
}
946
};
947
948
using DeviceIntPoint = Point2D<int32_t, DevicePixel>;
949
950
/// A 2d Rectangle optionally tagged with a unit.
951
template<typename T, typename U>
952
struct Rect {
953
Point2D<T, U> origin;
954
Size2D<T, U> size;
955
956
bool operator==(const Rect& aOther) const {
957
return origin == aOther.origin &&
958
size == aOther.size;
959
}
960
};
961
962
using DeviceIntRect = Rect<int32_t, DevicePixel>;
963
964
struct NativeTileId {
965
NativeSurfaceId surface_id;
966
int32_t x;
967
int32_t y;
968
969
bool operator==(const NativeTileId& aOther) const {
970
return surface_id == aOther.surface_id &&
971
x == aOther.x &&
972
y == aOther.y;
973
}
974
};
975
976
struct CompositorCapabilities {
977
int32_t virtual_surface_size;
978
979
bool operator==(const CompositorCapabilities& aOther) const {
980
return virtual_surface_size == aOther.virtual_surface_size;
981
}
982
};
983
984
struct WrClipId {
985
uintptr_t id;
986
987
bool operator==(const WrClipId& aOther) const {
988
return id == aOther.id;
989
}
990
};
991
992
struct WrSpatialId {
993
uintptr_t id;
994
995
bool operator==(const WrSpatialId& aOther) const {
996
return id == aOther.id;
997
}
998
};
999
1000
struct WrSpaceAndClip {
1001
WrSpatialId space;
1002
WrClipId clip;
1003
1004
bool operator==(const WrSpaceAndClip& aOther) const {
1005
return space == aOther.space &&
1006
clip == aOther.clip;
1007
}
1008
};
1009
1010
using LayoutRect = Rect<float, LayoutPixel>;
1011
1012
struct BorderRadius {
1013
LayoutSize top_left;
1014
LayoutSize top_right;
1015
LayoutSize bottom_left;
1016
LayoutSize bottom_right;
1017
1018
bool operator==(const BorderRadius& aOther) const {
1019
return top_left == aOther.top_left &&
1020
top_right == aOther.top_right &&
1021
bottom_left == aOther.bottom_left &&
1022
bottom_right == aOther.bottom_right;
1023
}
1024
};
1025
1026
struct ComplexClipRegion {
1027
/// The boundaries of the rectangle.
1028
LayoutRect rect;
1029
/// Border radii of this rectangle.
1030
BorderRadius radii;
1031
/// Whether we are clipping inside or outside
1032
/// the region.
1033
ClipMode mode;
1034
1035
bool operator==(const ComplexClipRegion& aOther) const {
1036
return rect == aOther.rect &&
1037
radii == aOther.radii &&
1038
mode == aOther.mode;
1039
}
1040
};
1041
1042
/// An opaque identifier describing an image registered with WebRender.
1043
/// This is used as a handle to reference images, and is used as the
1044
/// hash map key for the actual image storage in the `ResourceCache`.
1045
struct ImageKey {
1046
IdNamespace mNamespace;
1047
uint32_t mHandle;
1048
1049
bool operator==(const ImageKey& aOther) const {
1050
return mNamespace == aOther.mNamespace &&
1051
mHandle == aOther.mHandle;
1052
}
1053
bool operator!=(const ImageKey& aOther) const {
1054
return mNamespace != aOther.mNamespace ||
1055
mHandle != aOther.mHandle;
1056
}
1057
};
1058
1059
struct ImageMask {
1060
ImageKey image;
1061
LayoutRect rect;
1062
bool repeat;
1063
1064
bool operator==(const ImageMask& aOther) const {
1065
return image == aOther.image &&
1066
rect == aOther.rect &&
1067
repeat == aOther.repeat;
1068
}
1069
};
1070
1071
struct WrSpaceAndClipChain {
1072
WrSpatialId space;
1073
uint64_t clip_chain;
1074
1075
bool operator==(const WrSpaceAndClipChain& aOther) const {
1076
return space == aOther.space &&
1077
clip_chain == aOther.clip_chain;
1078
}
1079
};
1080
1081
using LayoutPoint = Point2D<float, LayoutPixel>;
1082
1083
/// The minimum and maximum allowable offset for a sticky frame in a single dimension.
1084
struct StickyOffsetBounds {
1085
/// The minimum offset for this frame, typically a negative value, which specifies how
1086
/// far in the negative direction the sticky frame can offset its contents in this
1087
/// dimension.
1088
float min;
1089
/// The maximum offset for this frame, typically a positive value, which specifies how
1090
/// far in the positive direction the sticky frame can offset its contents in this
1091
/// dimension.
1092
float max;
1093
1094
bool operator==(const StickyOffsetBounds& aOther) const {
1095
return min == aOther.min &&
1096
max == aOther.max;
1097
}
1098
};
1099
1100
/// A 2d Vector tagged with a unit.
1101
template<typename T, typename U>
1102
struct Vector2D {
1103
T x;
1104
T y;
1105
1106
bool operator==(const Vector2D& aOther) const {
1107
return x == aOther.x &&
1108
y == aOther.y;
1109
}
1110
};
1111
1112
using LayoutVector2D = Vector2D<float, LayoutPixel>;
1113
1114
/// An identifier used to refer to previously sent display items. Currently it
1115
/// refers to individual display items, but this may change later.
1116
using ItemKey = uint16_t;
1117
1118
/// A key to identify an animated property binding.
1119
struct PropertyBindingId {
1120
IdNamespace namespace_;
1121
uint32_t uid;
1122
1123
bool operator==(const PropertyBindingId& aOther) const {
1124
return namespace_ == aOther.namespace_ &&
1125
uid == aOther.uid;
1126
}
1127
};
1128
1129
/// A unique key that is used for connecting animated property
1130
/// values to bindings in the display list.
1131
template<typename T>
1132
struct PropertyBindingKey {
1133
///
1134
PropertyBindingId id;
1135
1136
bool operator==(const PropertyBindingKey& aOther) const {
1137
return id == aOther.id;
1138
}
1139
};
1140
1141
/// A binding property can either be a specific value
1142
/// (the normal, non-animated case) or point to a binding location
1143
/// to fetch the current value from.
1144
/// Note that Binding has also a non-animated value, the value is
1145
/// used for the case where the animation is still in-delay phase
1146
/// (i.e. the animation doesn't produce any animation values).
1147
template<typename T>
1148
struct PropertyBinding {
1149
enum class Tag {
1150
/// Non-animated value.
1151
Value,
1152
/// Animated binding.
1153
Binding,
1154
/// Must be last for serialization purposes
1155
Sentinel,
1156
};
1157
1158
struct Value_Body {
1159
T _0;
1160
1161
bool operator==(const Value_Body& aOther) const {
1162
return _0 == aOther._0;
1163
}
1164
};
1165
1166
struct Binding_Body {
1167
PropertyBindingKey<T> _0;
1168
T _1;
1169
1170
bool operator==(const Binding_Body& aOther) const {
1171
return _0 == aOther._0 &&
1172
_1 == aOther._1;
1173
}
1174
};
1175
1176
Tag tag;
1177
union {
1178
Value_Body value;
1179
Binding_Body binding;
1180
};
1181
1182
static PropertyBinding Value(const T &a0) {
1183
PropertyBinding result;
1184
::new (&result.value._0) (T)(a0);
1185
result.tag = Tag::Value;
1186
return result;
1187
}
1188
1189
bool IsValue() const {
1190
return tag == Tag::Value;
1191
}
1192
1193
static PropertyBinding Binding(const PropertyBindingKey<T> &a0,
1194
const T &a1) {
1195
PropertyBinding result;
1196
::new (&result.binding._0) (PropertyBindingKey<T>)(a0);
1197
::new (&result.binding._1) (T)(a1);
1198
result.tag = Tag::Binding;
1199
return result;
1200
}
1201
1202
bool IsBinding() const {
1203
return tag == Tag::Binding;
1204
}
1205
1206
static PropertyBinding Sentinel() {
1207
PropertyBinding result;
1208
result.tag = Tag::Sentinel;
1209
return result;
1210
}
1211
1212
bool IsSentinel() const {
1213
return tag == Tag::Sentinel;
1214
}
1215
1216
bool operator==(const PropertyBinding& aOther) const {
1217
if (tag != aOther.tag) {
1218
return false;
1219
}
1220
switch (tag) {
1221
case Tag::Value: return value == aOther.value;
1222
case Tag::Binding: return binding == aOther.binding;
1223
default: return true;
1224
}
1225
}
1226
};
1227
1228
/// Represents RGBA screen colors with floating point numbers.
1229
///
1230
/// All components must be between 0.0 and 1.0.
1231
/// An alpha value of 1.0 is opaque while 0.0 is fully transparent.
1232
struct ColorF {
1233
float r;
1234
float g;
1235
float b;
1236
float a;
1237
1238
bool operator==(const ColorF& aOther) const {
1239
return r == aOther.r &&
1240
g == aOther.g &&
1241
b == aOther.b &&
1242
a == aOther.a;
1243
}
1244
static const ColorF BLACK;
1245
static const ColorF TRANSPARENT;
1246
static const ColorF WHITE;
1247
};
1248
inline const ColorF ColorF::BLACK = ColorF{ /* .r = */ 0.0, /* .g = */ 0.0, /* .b = */ 0.0, /* .a = */ 1.0 };
1249
inline const ColorF ColorF::TRANSPARENT = ColorF{ /* .r = */ 0.0, /* .g = */ 0.0, /* .b = */ 0.0, /* .a = */ 0.0 };
1250
inline const ColorF ColorF::WHITE = ColorF{ /* .r = */ 1.0, /* .g = */ 1.0, /* .b = */ 1.0, /* .a = */ 1.0 };
1251
1252
struct Shadow {
1253
LayoutVector2D offset;
1254
ColorF color;
1255
float blur_radius;
1256
1257
bool operator==(const Shadow& aOther) const {
1258
return offset == aOther.offset &&
1259
color == aOther.color &&
1260
blur_radius == aOther.blur_radius;
1261
}
1262
};
1263
1264
/// CSS filter.
1265
struct FilterOp {
1266
enum class Tag {
1267
/// Filter that does no transformation of the colors, needed for
1268
/// debug purposes only.
1269
Identity,
1270
Blur,
1271
Brightness,
1272
Contrast,
1273
Grayscale,
1274
HueRotate,
1275
Invert,
1276
Opacity,
1277
Saturate,
1278
Sepia,
1279
DropShadow,
1280
ColorMatrix,
1281
SrgbToLinear,
1282
LinearToSrgb,
1283
ComponentTransfer,
1284
Flood,
1285
/// Must be last for serialization purposes
1286
Sentinel,
1287
};
1288
1289
struct Blur_Body {
1290
float _0;
1291
1292
bool operator==(const Blur_Body& aOther) const {
1293
return _0 == aOther._0;
1294
}
1295
};
1296
1297
struct Brightness_Body {
1298
float _0;
1299
1300
bool operator==(const Brightness_Body& aOther) const {
1301
return _0 == aOther._0;
1302
}
1303
};
1304
1305
struct Contrast_Body {
1306
float _0;
1307
1308
bool operator==(const Contrast_Body& aOther) const {
1309
return _0 == aOther._0;
1310
}
1311
};
1312
1313
struct Grayscale_Body {
1314
float _0;
1315
1316
bool operator==(const Grayscale_Body& aOther) const {
1317
return _0 == aOther._0;
1318
}
1319
};
1320
1321
struct HueRotate_Body {
1322
float _0;
1323
1324
bool operator==(const HueRotate_Body& aOther) const {
1325
return _0 == aOther._0;
1326
}
1327
};
1328
1329
struct Invert_Body {
1330
float _0;
1331
1332
bool operator==(const Invert_Body& aOther) const {
1333
return _0 == aOther._0;
1334
}
1335
};
1336
1337
struct Opacity_Body {
1338
PropertyBinding<float> _0;
1339
float _1;
1340
1341
bool operator==(const Opacity_Body& aOther) const {
1342
return _0 == aOther._0 &&
1343
_1 == aOther._1;
1344
}
1345
};
1346
1347
struct Saturate_Body {
1348
float _0;
1349
1350
bool operator==(const Saturate_Body& aOther) const {
1351
return _0 == aOther._0;
1352
}
1353
};
1354
1355
struct Sepia_Body {
1356
float _0;
1357
1358
bool operator==(const Sepia_Body& aOther) const {
1359
return _0 == aOther._0;
1360
}
1361
};
1362
1363
struct DropShadow_Body {
1364
Shadow _0;
1365
1366
bool operator==(const DropShadow_Body& aOther) const {
1367
return _0 == aOther._0;
1368
}
1369
};
1370
1371
struct ColorMatrix_Body {
1372
float _0[20];
1373
};
1374
1375
struct Flood_Body {
1376
ColorF _0;
1377
1378
bool operator==(const Flood_Body& aOther) const {
1379
return _0 == aOther._0;
1380
}
1381
};
1382
1383
Tag tag;
1384
union {
1385
Blur_Body blur;
1386
Brightness_Body brightness;
1387
Contrast_Body contrast;
1388
Grayscale_Body grayscale;
1389
HueRotate_Body hue_rotate;
1390
Invert_Body invert;
1391
Opacity_Body opacity;
1392
Saturate_Body saturate;
1393
Sepia_Body sepia;
1394
DropShadow_Body drop_shadow;
1395
ColorMatrix_Body color_matrix;
1396
Flood_Body flood;
1397
};
1398
1399
static FilterOp Identity() {
1400
FilterOp result;
1401
result.tag = Tag::Identity;
1402
return result;
1403
}
1404
1405
bool IsIdentity() const {
1406
return tag == Tag::Identity;
1407
}
1408
1409
static FilterOp Blur(const float &a0) {
1410
FilterOp result;
1411
::new (&result.blur._0) (float)(a0);
1412
result.tag = Tag::Blur;
1413
return result;
1414
}
1415
1416
bool IsBlur() const {
1417
return tag == Tag::Blur;
1418
}
1419
1420
static FilterOp Brightness(const float &a0) {
1421
FilterOp result;
1422
::new (&result.brightness._0) (float)(a0);
1423
result.tag = Tag::Brightness;
1424
return result;
1425
}
1426
1427
bool IsBrightness() const {
1428
return tag == Tag::Brightness;
1429
}
1430
1431
static FilterOp Contrast(const float &a0) {
1432
FilterOp result;
1433
::new (&result.contrast._0) (float)(a0);
1434
result.tag = Tag::Contrast;
1435
return result;
1436
}
1437
1438
bool IsContrast() const {
1439
return tag == Tag::Contrast;
1440
}
1441
1442
static FilterOp Grayscale(const float &a0) {
1443
FilterOp result;
1444
::new (&result.grayscale._0) (float)(a0);
1445
result.tag = Tag::Grayscale;
1446
return result;
1447
}
1448
1449
bool IsGrayscale() const {
1450
return tag == Tag::Grayscale;
1451
}
1452
1453
static FilterOp HueRotate(const float &a0) {
1454
FilterOp result;
1455
::new (&result.hue_rotate._0) (float)(a0);
1456
result.tag = Tag::HueRotate;
1457
return result;
1458
}
1459
1460
bool IsHueRotate() const {
1461
return tag == Tag::HueRotate;
1462
}
1463
1464
static FilterOp Invert(const float &a0) {
1465
FilterOp result;
1466
::new (&result.invert._0) (float)(a0);
1467
result.tag = Tag::Invert;
1468
return result;
1469
}
1470
1471
bool IsInvert() const {
1472
return tag == Tag::Invert;
1473
}
1474
1475
static FilterOp Opacity(const PropertyBinding<float> &a0,
1476
const float &a1) {
1477
FilterOp result;
1478
::new (&result.opacity._0) (PropertyBinding<float>)(a0);
1479
::new (&result.opacity._1) (float)(a1);
1480
result.tag = Tag::Opacity;
1481
return result;
1482
}
1483
1484
bool IsOpacity() const {
1485
return tag == Tag::Opacity;
1486
}
1487
1488
static FilterOp Saturate(const float &a0) {
1489
FilterOp result;
1490
::new (&result.saturate._0) (float)(a0);
1491
result.tag = Tag::Saturate;
1492
return result;
1493
}
1494
1495
bool IsSaturate() const {
1496
return tag == Tag::Saturate;
1497
}
1498
1499
static FilterOp Sepia(const float &a0) {
1500
FilterOp result;
1501
::new (&result.sepia._0) (float)(a0);
1502
result.tag = Tag::Sepia;
1503
return result;
1504
}
1505
1506
bool IsSepia() const {
1507
return tag == Tag::Sepia;
1508
}
1509
1510
static FilterOp DropShadow(const Shadow &a0) {
1511
FilterOp result;
1512
::new (&result.drop_shadow._0) (Shadow)(a0);
1513
result.tag = Tag::DropShadow;
1514
return result;
1515
}
1516
1517
bool IsDropShadow() const {
1518
return tag == Tag::DropShadow;
1519
}
1520
1521
static FilterOp ColorMatrix(const float (&a0)[20]) {
1522
FilterOp result;
1523
for (int i = 0; i < 20; i++) {
1524
::new (&result.color_matrix._0[i]) (float)(a0[i]);
1525
}
1526
result.tag = Tag::ColorMatrix;
1527
return result;
1528
}
1529
1530
bool IsColorMatrix() const {
1531
return tag == Tag::ColorMatrix;
1532
}
1533
1534
static FilterOp SrgbToLinear() {
1535
FilterOp result;
1536
result.tag = Tag::SrgbToLinear;
1537
return result;
1538
}
1539
1540
bool IsSrgbToLinear() const {
1541
return tag == Tag::SrgbToLinear;
1542
}
1543
1544
static FilterOp LinearToSrgb() {
1545
FilterOp result;
1546
result.tag = Tag::LinearToSrgb;
1547
return result;
1548
}
1549
1550
bool IsLinearToSrgb() const {
1551
return tag == Tag::LinearToSrgb;
1552
}
1553
1554
static FilterOp ComponentTransfer() {
1555
FilterOp result;
1556
result.tag = Tag::ComponentTransfer;
1557
return result;
1558
}
1559
1560
bool IsComponentTransfer() const {
1561
return tag == Tag::ComponentTransfer;
1562
}
1563
1564
static FilterOp Flood(const ColorF &a0) {
1565
FilterOp result;
1566
::new (&result.flood._0) (ColorF)(a0);
1567
result.tag = Tag::Flood;
1568
return result;
1569
}
1570
1571
bool IsFlood() const {
1572
return tag == Tag::Flood;
1573
}
1574
1575
static FilterOp Sentinel() {
1576
FilterOp result;
1577
result.tag = Tag::Sentinel;
1578
return result;
1579
}
1580
1581
bool IsSentinel() const {
1582
return tag == Tag::Sentinel;
1583
}
1584
};
1585
1586
struct WrFilterData {
1587
ComponentTransferFuncType funcR_type;
1588
float *R_values;
1589
uintptr_t R_values_count;
1590
ComponentTransferFuncType funcG_type;
1591
float *G_values;
1592
uintptr_t G_values_count;
1593
ComponentTransferFuncType funcB_type;
1594
float *B_values;
1595
uintptr_t B_values_count;
1596
ComponentTransferFuncType funcA_type;
1597
float *A_values;
1598
uintptr_t A_values_count;
1599
1600
bool operator==(const WrFilterData& aOther) const {
1601
return funcR_type == aOther.funcR_type &&
1602
R_values == aOther.R_values &&
1603
R_values_count == aOther.R_values_count &&
1604
funcG_type == aOther.funcG_type &&
1605
G_values == aOther.G_values &&
1606
G_values_count == aOther.G_values_count &&
1607
funcB_type == aOther.funcB_type &&
1608
B_values == aOther.B_values &&
1609
B_values_count == aOther.B_values_count &&
1610
funcA_type == aOther.funcA_type &&
1611
A_values == aOther.A_values &&
1612
A_values_count == aOther.A_values_count;
1613
}
1614
};
1615
1616
/// A group of 2D side offsets, which correspond to top/left/bottom/right for borders, padding,
1617
/// and margins in CSS, optionally tagged with a unit.
1618
template<typename T, typename U>
1619
struct SideOffsets2D {
1620
T top;
1621
T right;
1622
T bottom;
1623
T left;
1624
1625
bool operator==(const SideOffsets2D& aOther) const {
1626
return top == aOther.top &&
1627
right == aOther.right &&
1628
bottom == aOther.bottom &&
1629
left == aOther.left;
1630
}
1631
};
1632
1633
using LayoutSideOffsets = SideOffsets2D<float, LayoutPixel>;
1634
1635
struct BorderSide {
1636
ColorF color;
1637
BorderStyle style;
1638
1639
bool operator==(const BorderSide& aOther) const {
1640
return color == aOther.color &&
1641
style == aOther.style;
1642
}
1643
};
1644
1645
struct GradientStop {
1646
float offset;
1647
ColorF color;
1648
1649
bool operator==(const GradientStop& aOther) const {
1650
return offset == aOther.offset &&
1651
color == aOther.color;
1652
}
1653
};
1654
1655
using DeviceIntSideOffsets = SideOffsets2D<int32_t, DevicePixel>;
1656
1657
using WrImageKey = ImageKey;
1658
1659
struct WrBorderImage {
1660
LayoutSideOffsets widths;
1661
WrImageKey image;
1662
int32_t width;
1663
int32_t height;
1664
bool fill;
1665
DeviceIntSideOffsets slice;
1666
LayoutSideOffsets outset;
1667
RepeatMode repeat_horizontal;
1668
RepeatMode repeat_vertical;
1669
1670
bool operator==(const WrBorderImage& aOther) const {
1671
return widths == aOther.widths &&
1672
image == aOther.image &&
1673
width == aOther.width &&
1674
height == aOther.height &&
1675
fill == aOther.fill &&
1676
slice == aOther.slice &&
1677
outset == aOther.outset &&
1678
repeat_horizontal == aOther.repeat_horizontal &&
1679
repeat_vertical == aOther.repeat_vertical;
1680
}
1681
};
1682
1683
struct WrAnimationProperty {
1684
WrAnimationType effect_type;
1685
uint64_t id;
1686
1687
bool operator==(const WrAnimationProperty& aOther) const {
1688
return effect_type == aOther.effect_type &&
1689
id == aOther.id;
1690
}
1691
};
1692
1693
struct WrStackingContextClip {
1694
enum class Tag {
1695
None,
1696
ClipId,
1697
ClipChain,
1698
/// Must be last for serialization purposes
1699
Sentinel,
1700
};
1701
1702
struct ClipId_Body {
1703
WrClipId _0;
1704
1705
bool operator==(const ClipId_Body& aOther) const {
1706
return _0 == aOther._0;
1707
}
1708
};
1709
1710
struct ClipChain_Body {
1711
uint64_t _0;
1712
1713
bool operator==(const ClipChain_Body& aOther) const {
1714
return _0 == aOther._0;
1715
}
1716
};
1717
1718
Tag tag;
1719
union {
1720
ClipId_Body clip_id;
1721
ClipChain_Body clip_chain;
1722
};
1723
1724
static WrStackingContextClip None() {
1725
WrStackingContextClip result;
1726
result.tag = Tag::None;
1727
return result;
1728
}
1729
1730
bool IsNone() const {
1731
return tag == Tag::None;
1732
}
1733
1734
static WrStackingContextClip ClipId(const WrClipId &a0) {
1735
WrStackingContextClip result;
1736
::new (&result.clip_id._0) (WrClipId)(a0);
1737
result.tag = Tag::ClipId;
1738
return result;
1739
}
1740
1741
bool IsClipId() const {
1742
return tag == Tag::ClipId;
1743
}
1744
1745
static WrStackingContextClip ClipChain(const uint64_t &a0) {
1746
WrStackingContextClip result;
1747
::new (&result.clip_chain._0) (uint64_t)(a0);
1748
result.tag = Tag::ClipChain;
1749
return result;
1750
}
1751
1752
bool IsClipChain() const {
1753
return tag == Tag::ClipChain;
1754
}
1755
1756
static WrStackingContextClip Sentinel() {
1757
WrStackingContextClip result;
1758
result.tag = Tag::Sentinel;
1759
return result;
1760
}
1761
1762
bool IsSentinel() const {
1763
return tag == Tag::Sentinel;
1764
}
1765
1766
bool operator==(const WrStackingContextClip& aOther) const {
1767
if (tag != aOther.tag) {
1768
return false;
1769
}
1770
switch (tag) {
1771
case Tag::ClipId: return clip_id == aOther.clip_id;
1772
case Tag::ClipChain: return clip_chain == aOther.clip_chain;
1773
default: return true;
1774
}
1775
}
1776
};
1777
1778
struct PrimitiveFlags {
1779
uint8_t bits;
1780
1781
explicit operator bool() const {
1782
return !!bits;
1783
}
1784
PrimitiveFlags operator~() const {
1785
return {static_cast<decltype(bits)>(~bits)};
1786
}
1787
PrimitiveFlags operator|(const PrimitiveFlags& aOther) const {
1788
return {static_cast<decltype(bits)>(this->bits | aOther.bits)};
1789
}
1790
PrimitiveFlags& operator|=(const PrimitiveFlags& aOther) {
1791
*this = (*this | aOther);
1792
return *this;
1793
}
1794
PrimitiveFlags operator&(const PrimitiveFlags& aOther) const {
1795
return {static_cast<decltype(bits)>(this->bits & aOther.bits)};
1796
}
1797
PrimitiveFlags& operator&=(const PrimitiveFlags& aOther) {
1798
*this = (*this & aOther);
1799
return *this;
1800
}
1801
PrimitiveFlags operator^(const PrimitiveFlags& aOther) const {
1802
return {static_cast<decltype(bits)>(this->bits ^ aOther.bits)};
1803
}
1804
PrimitiveFlags& operator^=(const PrimitiveFlags& aOther) {
1805
*this = (*this ^ aOther);
1806
return *this;
1807
}
1808
bool operator==(const PrimitiveFlags& aOther) const {
1809
return bits == aOther.bits;
1810
}
1811
static const PrimitiveFlags IS_BACKFACE_VISIBLE;
1812
static const PrimitiveFlags IS_SCROLLBAR_CONTAINER;
1813
static const PrimitiveFlags IS_SCROLLBAR_THUMB;
1814
static const PrimitiveFlags PREFER_COMPOSITOR_SURFACE;
1815
};
1816
inline const PrimitiveFlags PrimitiveFlags::IS_BACKFACE_VISIBLE = PrimitiveFlags{ /* .bits = */ (1 << 0) };
1817
inline const PrimitiveFlags PrimitiveFlags::IS_SCROLLBAR_CONTAINER = PrimitiveFlags{ /* .bits = */ (1 << 1) };
1818
inline const PrimitiveFlags PrimitiveFlags::IS_SCROLLBAR_THUMB = PrimitiveFlags{ /* .bits = */ (1 << 2) };
1819
inline const PrimitiveFlags PrimitiveFlags::PREFER_COMPOSITOR_SURFACE = PrimitiveFlags{ /* .bits = */ (1 << 3) };
1820
1821
/// IMPORTANT: If you add fields to this struct, you need to also add initializers
1822
/// for those fields in WebRenderAPI.h.
1823
struct WrStackingContextParams {
1824
WrStackingContextClip clip;
1825
const WrAnimationProperty *animation;
1826
const float *opacity;
1827
TransformStyle transform_style;
1828
WrReferenceFrameKind reference_frame_kind;
1829
const uint64_t *scrolling_relative_to;
1830
PrimitiveFlags prim_flags;
1831
/// True if picture caching should be enabled for this stacking context.
1832
bool cache_tiles;
1833
MixBlendMode mix_blend_mode;
1834
/// True if this stacking context is a backdrop root.
1836
bool is_backdrop_root;
1837
1838
bool operator==(const WrStackingContextParams& aOther) const {
1839
return clip == aOther.clip &&
1840
animation == aOther.animation &&
1841
opacity == aOther.opacity &&
1842
transform_style == aOther.transform_style &&
1843
reference_frame_kind == aOther.reference_frame_kind &&
1844
scrolling_relative_to == aOther.scrolling_relative_to &&
1845
prim_flags == aOther.prim_flags &&
1846
cache_tiles == aOther.cache_tiles &&
1847
mix_blend_mode == aOther.mix_blend_mode &&
1848
is_backdrop_root == aOther.is_backdrop_root;
1849
}
1850
};
1851
1852
/// A 3d transform stored as a 4 by 4 matrix in row-major order in memory.
1853
///
1854
/// Transforms can be parametrized over the source and destination units, to describe a
1855
/// transformation from a space to another.
1856
/// For example, `Transform3D<f32, WorldSpace, ScreenSpace>::transform_point3d`
1857
/// takes a `Point3D<f32, WorldSpace>` and returns a `Point3D<f32, ScreenSpace>`.
1858
///
1859
/// Transforms expose a set of convenience methods for pre- and post-transformations.
1860
/// A pre-transformation corresponds to adding an operation that is applied before
1861
/// the rest of the transformation, while a post-transformation adds an operation
1862
/// that is applied after.
1863
///
1864
/// These transforms are for working with _row vectors_, so the matrix math for transforming
1865
/// a vector is `v * T`. If your library is using column vectors, use `row_major` functions when you
1866
/// are asked for `column_major` representations and vice versa.
1867
template<typename T, typename Src, typename Dst>
1868
struct Transform3D {
1869
T m11;
1870
T m12;
1871
T m13;
1872
T m14;
1873
T m21;
1874
T m22;
1875
T m23;
1876
T m24;
1877
T m31;
1878
T m32;
1879
T m33;
1880
T m34;
1881
T m41;
1882
T m42;
1883
T m43;
1884
T m44;
1885
1886
bool operator==(const Transform3D& aOther) const {
1887
return m11 == aOther.m11 &&
1888
m12 == aOther.m12 &&
1889
m13 == aOther.m13 &&
1890
m14 == aOther.m14 &&
1891
m21 == aOther.m21 &&
1892
m22 == aOther.m22 &&
1893
m23 == aOther.m23 &&
1894
m24 == aOther.m24 &&
1895
m31 == aOther.m31 &&
1896
m32 == aOther.m32 &&
1897
m33 == aOther.m33 &&
1898
m34 == aOther.m34 &&
1899
m41 == aOther.m41 &&
1900
m42 == aOther.m42 &&
1901
m43 == aOther.m43 &&
1902
m44 == aOther.m44;
1903
}
1904
};
1905
1906
using LayoutTransform = Transform3D<float, LayoutPixel, LayoutPixel>;
1907
1908
/// Configure whether the contents of a stacking context
1909
/// should be rasterized in local space or screen space.
1910
/// Local space rasterized pictures are typically used
1911
/// when we want to cache the output, and performance is
1912
/// important. Note that this is a performance hint only,
1913
/// which WR may choose to ignore.
1914
union RasterSpace {
1915
enum class Tag : uint8_t {
1916
Local,
1917
Screen,
1918
/// Must be last for serialization purposes
1919
Sentinel,
1920
};
1921
1922
struct Local_Body {
1923
Tag tag;
1924
float _0;
1925
1926
bool operator==(const Local_Body& aOther) const {
1927
return _0 == aOther._0;
1928
}
1929
};
1930
1931
struct {
1932
Tag tag;
1933
};
1934
Local_Body local;
1935
1936
static RasterSpace Local(const float &a0) {
1937
RasterSpace result;
1938
::new (&result.local._0) (float)(a0);
1939
result.tag = Tag::Local;
1940
return result;
1941
}
1942
1943
bool IsLocal() const {
1944
return tag == Tag::Local;
1945
}
1946
1947
static RasterSpace Screen() {
1948
RasterSpace result;
1949
result.tag = Tag::Screen;
1950
return result;
1951
}
1952
1953
bool IsScreen() const {
1954
return tag == Tag::Screen;
1955
}
1956
1957
static RasterSpace Sentinel() {
1958
RasterSpace result;
1959
result.tag = Tag::Sentinel;
1960
return result;
1961
}
1962
1963
bool IsSentinel() const {
1964
return tag == Tag::Sentinel;
1965
}
1966
1967
bool operator==(const RasterSpace& aOther) const {
1968
if (tag != aOther.tag) {
1969
return false;
1970
}
1971
switch (tag) {
1972
case Tag::Local: return local == aOther.local;
1973
default: return true;
1974
}
1975
}
1976
};
1977
1978
using GlyphIndex = uint32_t;
1979
1980
struct GlyphInstance {
1981
GlyphIndex index;
1982
LayoutPoint point;
1983
1984
bool operator==(const GlyphInstance& aOther) const {
1985
return index == aOther.index &&
1986
point == aOther.point;
1987
}
1988
};
1989
1990
struct GlyphOptions {
1991
FontRenderMode render_mode;
1992
FontInstanceFlags flags;
1993
1994
bool operator==(const GlyphOptions& aOther) const {
1995
return render_mode == aOther.render_mode &&
1996
flags == aOther.flags;
1997
}
1998
};
1999
2000
using WrColorDepth = ColorDepth;
2001
2002
using WrYuvColorSpace = YuvColorSpace;
2003
2004
using WrColorRange = ColorRange;
2005
2006
struct ByteSlice {
2007
const uint8_t *buffer;
2008
uintptr_t len;
2009
2010
bool operator==(const ByteSlice& aOther) const {
2011
return buffer == aOther.buffer &&
2012
len == aOther.len;
2013
}
2014
};
2015
2016
using LayoutIntRect = Rect<int32_t, LayoutPixel>;
2017
2018
using TileOffset = Point2D<int32_t, TileCoordinate>;
2019
2020
struct MutByteSlice {
2021
uint8_t *buffer;
2022
uintptr_t len;
2023
2024
bool operator==(const MutByteSlice& aOther) const {
2025
return buffer == aOther.buffer &&
2026
len == aOther.len;
2027
}
2028
};
2029
2030
/// A C function that takes a pointer to a heap allocation and returns its size.
2031
///
2032
/// This is borrowed from the malloc_size_of crate, upon which we want to avoid
2033
/// a dependency from WebRender.
2034
using VoidPtrToSizeFn = uintptr_t(*)(const void *ptr);
2035
2036
/// A handle to a screenshot that is being asynchronously captured and scaled.
2037
struct AsyncScreenshotHandle {
2038
uintptr_t _0;
2039
2040
bool operator==(const AsyncScreenshotHandle& aOther) const {
2041
return _0 == aOther._0;
2042
}
2043
};
2044
2045
struct WrExternalImage {
2046
WrExternalImageType image_type;
2047
uint32_t handle;
2048
float u0;
2049
float v0;
2050
float u1;
2051
float v1;
2052
const uint8_t *buff;
2053
uintptr_t size;
2054
2055
bool operator==(const WrExternalImage& aOther) const {
2056
return image_type == aOther.image_type &&
2057
handle == aOther.handle &&
2058
u0 == aOther.u0 &&
2059
v0 == aOther.v0 &&
2060
u1 == aOther.u1 &&
2061
v1 == aOther.v1 &&
2062
buff == aOther.buff &&
2063
size == aOther.size;
2064
}
2065
};
2066
2067
/// An arbitrary identifier for an external image provided by the
2068
/// application. It must be a unique identifier for each external
2069
/// image.
2070
struct ExternalImageId {
2071
uint64_t _0;
2072
2073
bool operator==(const ExternalImageId& aOther) const {
2074
return _0 == aOther._0;
2075
}
2076
};
2077
2078
/// A handle to a recorded frame that was captured.
2079
struct RecordedFrameHandle {
2080
uintptr_t _0;
2081
2082
bool operator==(const RecordedFrameHandle& aOther) const {
2083
return _0 == aOther._0;
2084
}
2085
};
2086
2087
/// Some basic statistics about the rendered scene, used in Gecko, as
2088
/// well as in wrench reftests to ensure that tests are batching and/or
2089
/// allocating on render targets as we expect them to.
2090
struct RendererStats {
2091
uintptr_t total_draw_calls;
2092
uintptr_t alpha_target_count;
2093
uintptr_t color_target_count;
2094
uintptr_t texture_upload_kb;
2095
uint64_t resource_upload_time;
2096
uint64_t gpu_cache_upload_time;
2097
2098
bool operator==(const RendererStats& aOther) const {
2099
return total_draw_calls == aOther.total_draw_calls &&
2100
alpha_target_count == aOther.alpha_target_count &&
2101
color_target_count == aOther.color_target_count &&
2102
texture_upload_kb == aOther.texture_upload_kb &&
2103
resource_upload_time == aOther.resource_upload_time &&
2104
gpu_cache_upload_time == aOther.gpu_cache_upload_time;
2105
}
2106
};
2107
2108
struct WrExternalImageHandler {
2109
void *external_image_obj;
2110
2111
bool operator==(const WrExternalImageHandler& aOther) const {
2112
return external_image_obj == aOther.external_image_obj;
2113
}
2114
};
2115
2116
/// An opaque identifier describing a blob image registered with WebRender.
2117
/// This is used as a handle to reference blob images, and can be used as an
2118
/// image in display items.
2119
struct BlobImageKey {
2120
ImageKey _0;
2121
2122
bool operator==(const BlobImageKey& aOther) const {
2123
return _0 == aOther._0;
2124
}
2125
};
2126
2127
struct WrImageDescriptor {
2128
ImageFormat format;
2129
int32_t width;
2130
int32_t height;
2131
int32_t stride;
2132
OpacityType opacity;
2133
bool prefer_compositor_surface;
2134
2135
bool operator==(const WrImageDescriptor& aOther) const {
2136
return format == aOther.format &&
2137
width == aOther.width &&
2138
height == aOther.height &&
2139
stride == aOther.stride &&
2140
opacity == aOther.opacity &&
2141
prefer_compositor_surface == aOther.prefer_compositor_surface;
2142
}
2143
};
2144
2145
/// Storage format identifier for externally-managed images.
2146
union ExternalImageType {
2147
enum class Tag : uint8_t {
2148
/// The image is texture-backed.
2149
TextureHandle,
2150
/// The image is heap-allocated by the embedding.
2151
Buffer,
2152
/// Must be last for serialization purposes
2153
Sentinel,
2154
};
2155
2156
struct TextureHandle_Body {
2157
Tag tag;
2158
TextureTarget _0;
2159
2160
bool operator==(const TextureHandle_Body& aOther) const {
2161
return _0 == aOther._0;
2162
}
2163
};
2164
2165
struct {
2166
Tag tag;
2167
};
2168
TextureHandle_Body texture_handle;
2169
2170
static ExternalImageType TextureHandle(const TextureTarget &a0) {
2171
ExternalImageType result;
2172
::new (&result.texture_handle._0) (TextureTarget)(a0);
2173
result.tag = Tag::TextureHandle;
2174
return result;
2175
}
2176
2177
bool IsTextureHandle() const {
2178
return tag == Tag::TextureHandle;
2179
}
2180
2181
static ExternalImageType Buffer() {
2182
ExternalImageType result;
2183
result.tag = Tag::Buffer;
2184
return result;
2185
}
2186
2187
bool IsBuffer() const {
2188
return tag == Tag::Buffer;
2189
}
2190
2191
static ExternalImageType Sentinel() {
2192
ExternalImageType result;
2193
result.tag = Tag::Sentinel;
2194
return result;
2195
}
2196
2197
bool IsSentinel() const {
2198
return tag == Tag::Sentinel;
2199
}
2200
2201
bool operator==(const ExternalImageType& aOther) const {
2202
if (tag != aOther.tag) {
2203
return false;
2204
}
2205
switch (tag) {
2206
case Tag::TextureHandle: return texture_handle == aOther.texture_handle;
2207
default: return true;
2208
}
2209
}
2210
};
2211
2212
template<typename T>
2213
struct WrAnimationPropertyValue {
2214
uint64_t id;
2215
T value;
2216
};
2217
2218
using WrTransformProperty = WrAnimationPropertyValue<LayoutTransform>;
2219
2220
using WrOpacityProperty = WrAnimationPropertyValue<float>;
2221
2222
using WrColorProperty = WrAnimationPropertyValue<ColorF>;
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
229