Bug 1703443 - pt 6. Move RunNextCollectorTimer() into CCGCScheduler r=smaug
[gecko.git] / gfx / thebes / gfxTypes.h
blob74e99c8b3462fb93e077bf57a2d2485795241aa5
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_TYPES_H
7 #define GFX_TYPES_H
9 #include <stdint.h>
10 #include "mozilla/TypedEnumBits.h"
12 namespace mozilla {
13 enum class StyleGenericFontFamily : uint8_t;
16 typedef struct _cairo_surface cairo_surface_t;
17 typedef struct _cairo_user_data_key cairo_user_data_key_t;
19 typedef void (*thebes_destroy_func_t)(void* data);
21 /**
22 * Currently needs to be 'double' for Cairo compatibility. Could
23 * become 'float', perhaps, in some configurations.
25 typedef double gfxFloat;
27 /**
28 * Priority of a line break opportunity.
30 * eNoBreak The line has no break opportunities
31 * eWordWrapBreak The line has a break opportunity only within a word. With
32 * overflow-wrap|word-wrap: break-word we will break at this
33 * point only if there are no other break opportunities in the
34 * line.
35 * eNormalBreak The line has a break opportunity determined by the standard
36 * line-breaking algorithm.
38 * Future expansion: split eNormalBreak into multiple priorities, e.g.
39 * punctuation break and whitespace break (bug 389710).
40 * As and when we implement it, text-wrap: unrestricted will
41 * mean that priorities are ignored and all line-break
42 * opportunities are equal.
44 * @see gfxTextRun::BreakAndMeasureText
45 * @see nsLineLayout::NotifyOptionalBreakPosition
47 enum class gfxBreakPriority { eNoBreak = 0, eWordWrapBreak, eNormalBreak };
49 enum class gfxSurfaceType {
50 Image,
51 PDF,
52 PS,
53 Xlib,
54 Xcb,
55 Glitz, // unused, but needed for cairo parity
56 Quartz,
57 Win32,
58 BeOS,
59 DirectFB, // unused, but needed for cairo parity
60 SVG,
61 OS2,
62 Win32Printing,
63 QuartzImage,
64 Script,
65 QPainter,
66 Recording,
67 VG,
68 GL,
69 DRM,
70 Tee,
71 XML,
72 Skia,
73 Subsurface,
74 Max
77 enum class gfxContentType {
78 COLOR = 0x1000,
79 ALPHA = 0x2000,
80 COLOR_ALPHA = 0x3000,
81 SENTINEL = 0xffff
84 enum class gfxAlphaType {
85 Opaque,
86 Premult,
87 NonPremult,
90 /**
91 * Type used to record how a particular font is selected during the font-
92 * matching process, so that this can be exposed to the Inspector.
94 struct FontMatchType {
95 enum class Kind : uint8_t {
96 kUnspecified = 0,
97 kFontGroup = 1,
98 kPrefsFallback = 1 << 1,
99 kSystemFallback = 1 << 2,
102 inline FontMatchType& operator|=(const FontMatchType& aOther);
104 bool operator==(const FontMatchType& aOther) const {
105 return kind == aOther.kind && generic == aOther.generic;
108 bool operator!=(const FontMatchType& aOther) const {
109 return !(*this == aOther);
112 MOZ_IMPLICIT FontMatchType() = default;
113 MOZ_IMPLICIT FontMatchType(Kind aKind) : kind(aKind) {}
114 FontMatchType(Kind aKind, mozilla::StyleGenericFontFamily aGeneric)
115 : kind(aKind), generic(aGeneric) {}
117 Kind kind = static_cast<Kind>(0);
118 // Using 0 to avoid pulling ServoStyleConsts.h everywhere.
119 mozilla::StyleGenericFontFamily generic = mozilla::StyleGenericFontFamily(0);
122 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(FontMatchType::Kind)
124 FontMatchType& FontMatchType::operator|=(const FontMatchType& aOther) {
125 kind |= aOther.kind;
126 // We only keep track of one generic.
127 if (generic != aOther.generic) {
128 generic = mozilla::StyleGenericFontFamily(0);
130 return *this;
133 struct HwStretchingSupport {
134 uint32_t mBoth;
135 uint32_t mWindowOnly;
136 uint32_t mFullScreenOnly;
137 uint32_t mNone;
138 uint32_t mError;
140 HwStretchingSupport()
141 : mBoth(0), mWindowOnly(0), mFullScreenOnly(0), mNone(0), mError(0) {}
143 bool IsFullySupported() const {
144 return mBoth > 0 && mWindowOnly == 0 && mFullScreenOnly == 0 &&
145 mNone == 0 && mError == 0;
149 #endif /* GFX_TYPES_H */