-
Notifications
You must be signed in to change notification settings - Fork 54
/
webrender_ffi_generated.h
1932 lines (1588 loc) · 53.4 KB
/
webrender_ffi_generated.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Generated with cbindgen:0.6.6 */
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --lockfile Cargo.lock --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
*/
#include <cstdint>
#include <cstdlib>
namespace mozilla {
namespace wr {
// Whether a border should be antialiased.
enum class AntialiasBorder {
No = 0,
Yes,
Sentinel /* this must be last for serialization purposes. */
};
enum class BorderStyle : uint32_t {
None = 0,
Solid = 1,
Double = 2,
Dotted = 3,
Dashed = 4,
Hidden = 5,
Groove = 6,
Ridge = 7,
Inset = 8,
Outset = 9,
Sentinel /* this must be last for serialization purposes. */
};
enum class BoxShadowClipMode : uint32_t {
Outset = 0,
Inset = 1,
Sentinel /* this must be last for serialization purposes. */
};
enum class Checkpoint : uint32_t {
SceneBuilt,
FrameBuilt,
FrameRendered,
// NotificationRequests get notified with this if they get dropped without having been
// notified. This provides the guarantee that if a request is created it will get notified.
TransactionDropped,
Sentinel /* this must be last for serialization purposes. */
};
enum class ClipMode {
Clip,
ClipOut,
Sentinel /* this must be last for serialization purposes. */
};
// Specifies the color depth of an image. Currently only used for YUV images.
enum class ColorDepth : uint8_t {
// 8 bits image (most common)
Color8,
// 10 bits image
Color10,
// 12 bits image
Color12,
// 16 bits image
Color16,
Sentinel /* this must be last for serialization purposes. */
};
enum class ExtendMode : uint32_t {
Clamp,
Repeat,
Sentinel /* this must be last for serialization purposes. */
};
#if !(defined(XP_MACOSX) || defined(XP_WIN))
enum class FontHinting : uint8_t {
None,
Mono,
Light,
Normal,
LCD,
Sentinel /* this must be last for serialization purposes. */
};
#endif
#if !(defined(XP_MACOSX) || defined(XP_WIN))
enum class FontLCDFilter : uint8_t {
None,
Default,
Light,
Legacy,
Sentinel /* this must be last for serialization purposes. */
};
#endif
enum class FontRenderMode : uint32_t {
Mono = 0,
Alpha,
Subpixel,
Sentinel /* this must be last for serialization purposes. */
};
// Specifies the format of a series of pixels, in driver terms.
enum class ImageFormat : uint32_t {
// One-channel, byte storage. The "red" doesn't map to the color
// red per se, and is just the way that OpenGL has historically referred
// to single-channel buffers.
R8 = 1,
// One-channel, short storage
R16 = 2,
// Four channels, byte storage.
BGRA8 = 3,
// Four channels, float storage.
RGBAF32 = 4,
// Two-channels, byte storage. Similar to `R8`, this just means
// "two channels" rather than "red and green".
RG8 = 5,
// Four channels, signed integer storage.
RGBAI32 = 6,
Sentinel /* this must be last for serialization purposes. */
};
enum class ImageRendering : uint32_t {
Auto = 0,
CrispEdges = 1,
Pixelated = 2,
Sentinel /* this must be last for serialization purposes. */
};
enum class LineOrientation : uint8_t {
Vertical,
Horizontal,
Sentinel /* this must be last for serialization purposes. */
};
enum class LineStyle : uint8_t {
Solid,
Dotted,
Dashed,
Wavy,
Sentinel /* this must be last for serialization purposes. */
};
enum class MixBlendMode : uint32_t {
Normal = 0,
Multiply = 1,
Screen = 2,
Overlay = 3,
Darken = 4,
Lighten = 5,
ColorDodge = 6,
ColorBurn = 7,
HardLight = 8,
SoftLight = 9,
Difference = 10,
Exclusion = 11,
Hue = 12,
Saturation = 13,
Color = 14,
Luminosity = 15,
Sentinel /* this must be last for serialization purposes. */
};
// Used to indicate if an image is opaque, or has an alpha channel.
enum class OpacityType : uint8_t {
Opaque = 0,
HasAlphaChannel = 1,
Sentinel /* this must be last for serialization purposes. */
};
enum class RepeatMode : uint32_t {
Stretch,
Repeat,
Round,
Space,
Sentinel /* this must be last for serialization purposes. */
};
enum class TelemetryProbe {
SceneBuildTime = 0,
SceneSwapTime = 1,
RenderTime = 2,
Sentinel /* this must be last for serialization purposes. */
};
enum class TransformStyle : uint32_t {
Flat = 0,
Preserve3D = 1,
Sentinel /* this must be last for serialization purposes. */
};
enum class WrAnimationType : uint32_t {
Transform = 0,
Opacity = 1,
Sentinel /* this must be last for serialization purposes. */
};
enum class WrExternalImageBufferType {
TextureHandle = 0,
TextureRectHandle = 1,
TextureArrayHandle = 2,
TextureExternalHandle = 3,
ExternalBuffer = 4,
Sentinel /* this must be last for serialization purposes. */
};
enum class WrExternalImageType : uint32_t {
RawData,
NativeTexture,
Invalid,
Sentinel /* this must be last for serialization purposes. */
};
enum class WrFilterOpType : uint32_t {
Blur = 0,
Brightness = 1,
Contrast = 2,
Grayscale = 3,
HueRotate = 4,
Invert = 5,
Opacity = 6,
Saturate = 7,
Sepia = 8,
DropShadow = 9,
ColorMatrix = 10,
Sentinel /* this must be last for serialization purposes. */
};
enum class YuvColorSpace : uint32_t {
Rec601 = 0,
Rec709 = 1,
Sentinel /* this must be last for serialization purposes. */
};
template<typename T>
struct Arc;
struct Device;
// Geometry in the coordinate system of the render target (screen or intermediate
// surface) in physical pixels.
struct DevicePixel;
struct DocumentHandle;
// Geometry in a stacking context's local coordinate space (logical pixels).
struct LayoutPixel;
// The renderer is responsible for submitting to the GPU the work prepared by the
// RenderBackend.
//
// We have a separate `Renderer` instance for each instance of WebRender (generally
// one per OS window), and all instances share the same thread.
struct Renderer;
// Offset in number of tiles.
struct Tiles;
// Represents the work associated to a transaction before scene building.
struct Transaction;
// The default unit.
struct UnknownUnit;
template<typename T>
struct Vec;
// Geometry in the document's coordinate space (logical pixels).
struct WorldPixel;
struct WrProgramCache;
struct WrShaders;
struct WrState;
struct WrThreadPool;
struct IdNamespace {
uint32_t mHandle;
bool operator==(const IdNamespace& aOther) const {
return mHandle == aOther.mHandle;
}
bool operator!=(const IdNamespace& aOther) const {
return mHandle != aOther.mHandle;
}
bool operator<(const IdNamespace& aOther) const {
return mHandle < aOther.mHandle;
}
bool operator<=(const IdNamespace& aOther) const {
return mHandle <= aOther.mHandle;
}
};
struct FontInstanceKey {
IdNamespace mNamespace;
uint32_t mHandle;
bool operator==(const FontInstanceKey& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
using WrFontInstanceKey = FontInstanceKey;
struct FontKey {
IdNamespace mNamespace;
uint32_t mHandle;
bool operator==(const FontKey& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
using WrFontKey = FontKey;
// Represents RGBA screen colors with one byte per channel.
//
// If the alpha value `a` is 255 the color is opaque.
struct ColorU {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
bool operator==(const ColorU& aOther) const {
return r == aOther.r &&
g == aOther.g &&
b == aOther.b &&
a == aOther.a;
}
};
struct SyntheticItalics {
int16_t angle;
bool operator==(const SyntheticItalics& aOther) const {
return angle == aOther.angle;
}
};
struct FontInstanceOptions {
FontRenderMode render_mode;
FontInstanceFlags flags;
// When bg_color.a is != 0 and render_mode is FontRenderMode::Subpixel,
// the text will be rendered with bg_color.r/g/b as an opaque estimated
// background color.
ColorU bg_color;
SyntheticItalics synthetic_italics;
bool operator==(const FontInstanceOptions& aOther) const {
return render_mode == aOther.render_mode &&
flags == aOther.flags &&
bg_color == aOther.bg_color &&
synthetic_italics == aOther.synthetic_italics;
}
};
#if defined(XP_WIN)
struct FontInstancePlatformOptions {
uint16_t gamma;
uint16_t contrast;
bool operator==(const FontInstancePlatformOptions& aOther) const {
return gamma == aOther.gamma &&
contrast == aOther.contrast;
}
};
#endif
#if defined(XP_MACOSX)
struct FontInstancePlatformOptions {
uint32_t unused;
bool operator==(const FontInstancePlatformOptions& aOther) const {
return unused == aOther.unused;
}
};
#endif
#if !(defined(XP_MACOSX) || defined(XP_WIN))
struct FontInstancePlatformOptions {
FontLCDFilter lcd_filter;
FontHinting hinting;
bool operator==(const FontInstancePlatformOptions& aOther) const {
return lcd_filter == aOther.lcd_filter &&
hinting == aOther.hinting;
}
};
#endif
struct FontVariation {
uint32_t tag;
float value;
bool operator==(const FontVariation& aOther) const {
return tag == aOther.tag &&
value == aOther.value;
}
};
using VecU8 = Vec<uint8_t>;
using ArcVecU8 = Arc<VecU8>;
using WrIdNamespace = IdNamespace;
struct WrWindowId {
uint64_t mHandle;
bool operator==(const WrWindowId& aOther) const {
return mHandle == aOther.mHandle;
}
bool operator<(const WrWindowId& aOther) const {
return mHandle < aOther.mHandle;
}
bool operator<=(const WrWindowId& aOther) const {
return mHandle <= aOther.mHandle;
}
};
// This type carries no valuable semantics for WR. However, it reflects the fact that
// clients (Servo) may generate pipelines by different semi-independent sources.
// These pipelines still belong to the same `IdNamespace` and the same `DocumentId`.
// Having this extra Id field enables them to generate `PipelineId` without collision.
using PipelineSourceId = uint32_t;
// From the point of view of WR, `PipelineId` is completely opaque and generic as long as
// it's clonable, serializable, comparable, and hashable.
struct PipelineId {
PipelineSourceId mNamespace;
uint32_t mHandle;
bool operator==(const PipelineId& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
};
using WrPipelineId = PipelineId;
struct Epoch {
uint32_t mHandle;
bool operator==(const Epoch& aOther) const {
return mHandle == aOther.mHandle;
}
bool operator<(const Epoch& aOther) const {
return mHandle < aOther.mHandle;
}
bool operator<=(const Epoch& aOther) const {
return mHandle <= aOther.mHandle;
}
};
using WrEpoch = Epoch;
struct WrPipelineEpoch {
WrPipelineId pipeline_id;
WrEpoch epoch;
bool operator==(const WrPipelineEpoch& aOther) const {
return pipeline_id == aOther.pipeline_id &&
epoch == aOther.epoch;
}
};
template<typename T>
struct FfiVec {
const T *data;
uintptr_t length;
uintptr_t capacity;
bool operator==(const FfiVec& aOther) const {
return data == aOther.data &&
length == aOther.length &&
capacity == aOther.capacity;
}
};
struct WrPipelineInfo {
FfiVec<WrPipelineEpoch> epochs;
FfiVec<PipelineId> removed_pipelines;
bool operator==(const WrPipelineInfo& aOther) const {
return epochs == aOther.epochs &&
removed_pipelines == aOther.removed_pipelines;
}
};
// Collection of heap sizes, in bytes.
struct MemoryReport {
uintptr_t primitive_stores;
uintptr_t clip_stores;
uintptr_t gpu_cache_metadata;
uintptr_t gpu_cache_cpu_mirror;
uintptr_t render_tasks;
uintptr_t hit_testers;
uintptr_t fonts;
uintptr_t images;
uintptr_t rasterized_blobs;
uintptr_t gpu_cache_textures;
uintptr_t vertex_data_textures;
uintptr_t render_target_textures;
uintptr_t texture_cache_textures;
uintptr_t depth_target_textures;
bool operator==(const MemoryReport& aOther) const {
return primitive_stores == aOther.primitive_stores &&
clip_stores == aOther.clip_stores &&
gpu_cache_metadata == aOther.gpu_cache_metadata &&
gpu_cache_cpu_mirror == aOther.gpu_cache_cpu_mirror &&
render_tasks == aOther.render_tasks &&
hit_testers == aOther.hit_testers &&
fonts == aOther.fonts &&
images == aOther.images &&
rasterized_blobs == aOther.rasterized_blobs &&
gpu_cache_textures == aOther.gpu_cache_textures &&
vertex_data_textures == aOther.vertex_data_textures &&
render_target_textures == aOther.render_target_textures &&
texture_cache_textures == aOther.texture_cache_textures &&
depth_target_textures == aOther.depth_target_textures;
}
};
template<typename T, typename U>
struct TypedSize2D {
T width;
T height;
bool operator==(const TypedSize2D& aOther) const {
return width == aOther.width &&
height == aOther.height;
}
};
using DeviceUintSize = TypedSize2D<uint32_t, DevicePixel>;
using LayoutSize = TypedSize2D<float, LayoutPixel>;
// Describes the memory layout of a display list.
//
// A display list consists of some number of display list items, followed by a number of display
// items.
struct BuiltDisplayListDescriptor {
// The first IPC time stamp: before any work has been done
uint64_t builder_start_time;
// The second IPC time stamp: after serialization
uint64_t builder_finish_time;
// The third IPC time stamp: just before sending
uint64_t send_start_time;
// The amount of clipping nodes created while building this display list.
uintptr_t total_clip_nodes;
// The amount of spatial nodes created while building this display list.
uintptr_t total_spatial_nodes;
// An estimate of the number of primitives that will be created by this display list.
uintptr_t prim_count_estimate;
bool operator==(const BuiltDisplayListDescriptor& aOther) const {
return builder_start_time == aOther.builder_start_time &&
builder_finish_time == aOther.builder_finish_time &&
send_start_time == aOther.send_start_time &&
total_clip_nodes == aOther.total_clip_nodes &&
total_spatial_nodes == aOther.total_spatial_nodes &&
prim_count_estimate == aOther.prim_count_estimate;
}
};
struct WrVecU8 {
uint8_t *data;
uintptr_t length;
uintptr_t capacity;
bool operator==(const WrVecU8& aOther) const {
return data == aOther.data &&
length == aOther.length &&
capacity == aOther.capacity;
}
};
// A 2d Point tagged with a unit.
template<typename T, typename U>
struct TypedPoint2D {
T x;
T y;
bool operator==(const TypedPoint2D& aOther) const {
return x == aOther.x &&
y == aOther.y;
}
};
using WorldPoint = TypedPoint2D<float, WorldPixel>;
// A 2d Rectangle optionally tagged with a unit.
template<typename T, typename U>
struct TypedRect {
TypedPoint2D<T, U> origin;
TypedSize2D<T, U> size;
bool operator==(const TypedRect& aOther) const {
return origin == aOther.origin &&
size == aOther.size;
}
};
using LayoutRect = TypedRect<float, LayoutPixel>;
struct BorderRadius {
LayoutSize top_left;
LayoutSize top_right;
LayoutSize bottom_left;
LayoutSize bottom_right;
bool operator==(const BorderRadius& aOther) const {
return top_left == aOther.top_left &&
top_right == aOther.top_right &&
bottom_left == aOther.bottom_left &&
bottom_right == aOther.bottom_right;
}
};
struct ComplexClipRegion {
// The boundaries of the rectangle.
LayoutRect rect;
// Border radii of this rectangle.
BorderRadius radii;
// Whether we are clipping inside or outside
// the region.
ClipMode mode;
bool operator==(const ComplexClipRegion& aOther) const {
return rect == aOther.rect &&
radii == aOther.radii &&
mode == aOther.mode;
}
};
// An opaque identifier describing an image registered with WebRender.
// This is used as a handle to reference images, and is used as the
// hash map key for the actual image storage in the `ResourceCache`.
struct ImageKey {
IdNamespace mNamespace;
uint32_t mHandle;
bool operator==(const ImageKey& aOther) const {
return mNamespace == aOther.mNamespace &&
mHandle == aOther.mHandle;
}
bool operator!=(const ImageKey& aOther) const {
return mNamespace != aOther.mNamespace ||
mHandle != aOther.mHandle;
}
};
using WrImageKey = ImageKey;
struct WrImageMask {
WrImageKey image;
LayoutRect rect;
bool repeat;
bool operator==(const WrImageMask& aOther) const {
return image == aOther.image &&
rect == aOther.rect &&
repeat == aOther.repeat;
}
};
// The minimum and maximum allowable offset for a sticky frame in a single dimension.
struct StickyOffsetBounds {
// The minimum offset for this frame, typically a negative value, which specifies how
// far in the negative direction the sticky frame can offset its contents in this
// dimension.
float min;
// The maximum offset for this frame, typically a positive value, which specifies how
// far in the positive direction the sticky frame can offset its contents in this
// dimension.
float max;
bool operator==(const StickyOffsetBounds& aOther) const {
return min == aOther.min &&
max == aOther.max;
}
};
// A 2d Vector tagged with a unit.
template<typename T, typename U>
struct TypedVector2D {
T x;
T y;
bool operator==(const TypedVector2D& aOther) const {
return x == aOther.x &&
y == aOther.y;
}
};
using LayoutVector2D = TypedVector2D<float, LayoutPixel>;
template<typename T, typename U>
struct TypedSideOffsets2D {
T top;
T right;
T bottom;
T left;
bool operator==(const TypedSideOffsets2D& aOther) const {
return top == aOther.top &&
right == aOther.right &&
bottom == aOther.bottom &&
left == aOther.left;
}
};
using LayoutSideOffsets = TypedSideOffsets2D<float, LayoutPixel>;
// Represents RGBA screen colors with floating point numbers.
//
// All components must be between 0.0 and 1.0.
// An alpha value of 1.0 is opaque while 0.0 is fully transparent.
struct ColorF {
float r;
float g;
float b;
float a;
bool operator==(const ColorF& aOther) const {
return r == aOther.r &&
g == aOther.g &&
b == aOther.b &&
a == aOther.a;
}
};
struct BorderSide {
ColorF color;
BorderStyle style;
bool operator==(const BorderSide& aOther) const {
return color == aOther.color &&
style == aOther.style;
}
};
// The default side offset type with no unit.
template<typename T>
using SideOffsets2D = TypedSideOffsets2D<T, UnknownUnit>;
using LayoutPoint = TypedPoint2D<float, LayoutPixel>;
struct GradientStop {
float offset;
ColorF color;
bool operator==(const GradientStop& aOther) const {
return offset == aOther.offset &&
color == aOther.color;
}
};
struct Shadow {
LayoutVector2D offset;
ColorF color;
float blur_radius;
bool operator==(const Shadow& aOther) const {
return offset == aOther.offset &&
color == aOther.color &&
blur_radius == aOther.blur_radius;
}
};
struct WrAnimationProperty {
WrAnimationType effect_type;
uint64_t id;
bool operator==(const WrAnimationProperty& aOther) const {
return effect_type == aOther.effect_type &&
id == aOther.id;
}
};
// A 3d transform stored as a 4 by 4 matrix in row-major order in memory.
//
// Transforms can be parametrized over the source and destination units, to describe a
// transformation from a space to another.
// For example, `TypedTransform3D<f32, WorldSpace, ScreenSpace>::transform_point3d`
// takes a `TypedPoint3D<f32, WorldSpace>` and returns a `TypedPoint3D<f32, ScreenSpace>`.
//
// Transforms expose a set of convenience methods for pre- and post-transformations.
// A pre-transformation corresponds to adding an operation that is applied before
// the rest of the transformation, while a post-transformation adds an operation
// that is applied after.
template<typename T, typename Src, typename Dst>
struct TypedTransform3D {
T m11;
T m12;
T m13;
T m14;
T m21;
T m22;
T m23;
T m24;
T m31;
T m32;
T m33;
T m34;
T m41;
T m42;
T m43;
T m44;
bool operator==(const TypedTransform3D& aOther) const {
return m11 == aOther.m11 &&
m12 == aOther.m12 &&
m13 == aOther.m13 &&
m14 == aOther.m14 &&
m21 == aOther.m21 &&
m22 == aOther.m22 &&
m23 == aOther.m23 &&
m24 == aOther.m24 &&
m31 == aOther.m31 &&
m32 == aOther.m32 &&
m33 == aOther.m33 &&
m34 == aOther.m34 &&
m41 == aOther.m41 &&
m42 == aOther.m42 &&
m43 == aOther.m43 &&
m44 == aOther.m44;
}
};
using LayoutTransform = TypedTransform3D<float, LayoutPixel, LayoutPixel>;
struct WrFilterOp {
WrFilterOpType filter_type;
float argument;
LayoutVector2D offset;
ColorF color;
float matrix[20];
};
// Configure whether the contents of a stacking context
// should be rasterized in local space or screen space.
// Local space rasterized pictures are typically used
// when we want to cache the output, and performance is
// important. Note that this is a performance hint only,
// which WR may choose to ignore.
union RasterSpace {
enum class Tag : uint32_t {
Local,
Screen,
Sentinel /* this must be last for serialization purposes. */
};
struct Local_Body {
Tag tag;
float _0;
bool operator==(const Local_Body& aOther) const {
return _0 == aOther._0;
}
};
struct {
Tag tag;
};
Local_Body local;
static RasterSpace Local(float const& a0) {
RasterSpace result;
result.local._0 = a0;
result.tag = Tag::Local;
return result;
}
static RasterSpace Screen() {
RasterSpace result;
result.tag = Tag::Screen;
return result;
}
bool IsLocal() const {
return tag == Tag::Local;
}
bool IsScreen() const {
return tag == Tag::Screen;
}
bool operator==(const RasterSpace& aOther) const {
if (tag != aOther.tag) {
return false;
}
switch (tag) {
case Tag::Local: return local == aOther.local;
default: return true;
}
}
};
using GlyphIndex = uint32_t;
struct GlyphInstance {
GlyphIndex index;
LayoutPoint point;
bool operator==(const GlyphInstance& aOther) const {
return index == aOther.index &&
point == aOther.point;
}
};
struct GlyphOptions {
FontRenderMode render_mode;
FontInstanceFlags flags;
bool operator==(const GlyphOptions& aOther) const {
return render_mode == aOther.render_mode &&
flags == aOther.flags;
}
};
using WrColorDepth = ColorDepth;
using WrYuvColorSpace = YuvColorSpace;
struct ByteSlice {
const uint8_t *buffer;
uintptr_t len;
bool operator==(const ByteSlice& aOther) const {
return buffer == aOther.buffer &&
len == aOther.len;
}
};
using TileOffset = TypedPoint2D<uint16_t, Tiles>;
using DeviceUintRect = TypedRect<uint32_t, DevicePixel>;
struct MutByteSlice {
uint8_t *buffer;
uintptr_t len;
bool operator==(const MutByteSlice& aOther) const {
return buffer == aOther.buffer &&
len == aOther.len;
}
};
struct WrDebugFlags {
uint32_t mBits;
bool operator==(const WrDebugFlags& aOther) const {
return mBits == aOther.mBits;
}
};
struct WrExternalImage {
WrExternalImageType image_type;
uint32_t handle;
float u0;