65 {
66 struct Span {
67 float fA = 0.f, fB = 0.f;
68
69 Span makeInset(float o) const {
70 Span r = {fA + o, fB - o};
71 if (r.fA > r.fB) {
72 r.fA = r.fB = (r.fA + r.fB) / 2;
73 }
74 return r;
75 }
76
77 bool contains(Span r)
const {
return fA <= r.fA && fB >= r.fB; }
78 };
79 struct Result1D {
80 ShaderMode fShaderMode = ShaderMode::kNone;
84 };
85
87 auto filter = sampler.filter();
88 auto mm = sampler.mipmapMode();
89
90 auto canDoWrapInHW = [&](
int size,
Wrap wrap) {
91 if (alwaysUseShaderTileMode) {
92 return false;
93 }
94
97 return false;
98 }
100 return false;
101 }
104 return false;
105 }
106 return true;
107 };
108
110
111
112
113
114
115
116 bool aniso = sampler.isAniso();
118 if (aniso) {
120 (!domain || !subset.
contains(*domain));
121 bool needsShaderWrap = !canDoWrapInHW(dim.
width(), sampler.wrapModeX()) ||
122 !canDoWrapInHW(dim.
height(), sampler.wrapModeY());
123 if (needsShaderWrap || anisoSubset) {
128 sampler.wrapModeY(),
130 newMM);
131 aniso = false;
132 }
133 }
134
135 auto resolve = [&](
int size,
Wrap wrap, Span subset, Span domain,
float linearFilterInset) {
136 Result1D r;
137 bool canDoModeInHW = canDoWrapInHW(
size, wrap);
138 if (canDoModeInHW &&
size > 0 && subset.fA <= 0 && subset.fB >=
size) {
139 r.fShaderMode = ShaderMode::kNone;
140 r.fHWWrap = wrap;
141 r.fShaderSubset = r.fShaderClamp = {0, 0};
142 return r;
143 }
144
145 r.fShaderSubset = subset;
146 bool domainIsSafe = false;
149 if (domain.fA > isubset.fA && domain.fB < isubset.fB) {
150 domainIsSafe = true;
151 }
152
153
154
156 } else {
157 r.fShaderClamp = subset.makeInset(linearFilterInset +
kInsetEpsilon);
158 if (r.fShaderClamp.contains(domain)) {
159 domainIsSafe = true;
160 }
161 }
162 if (!alwaysUseShaderTileMode && domainIsSafe) {
163
164
165
166 r.fShaderMode = ShaderMode::kNone;
168 r.fShaderSubset = r.fShaderClamp = {0, 0};
169 return r;
170 }
171 r.fShaderMode = GetShaderMode(wrap, filter, mm);
173 return r;
174 };
175
177 if (!aniso) {
178 Span subsetX{subset.fLeft, subset.fRight};
179 auto domainX = domain ? Span{domain->fLeft, domain->fRight}
181 x = resolve(dim.
width(), sampler.wrapModeX(), subsetX, domainX, linearFilterInset.
fX);
182
183 Span subsetY{subset.fTop, subset.fBottom};
184 auto domainY = domain ? Span{domain->fTop, domain->fBottom}
186 y = resolve(dim.
height(), sampler.wrapModeY(), subsetY, domainY, linearFilterInset.
fY);
187 } else {
188 x.fHWWrap = sampler.wrapModeX();
189 y.fHWWrap = sampler.wrapModeY();
190 }
191
194 sampler.maxAniso(),
200 x.fShaderSubset.fB,
y.fShaderSubset.fB};
202 x.fShaderClamp.fB,
y.fShaderClamp.fB};
203 std::copy_n(border, 4,
fBorder);
204}
constexpr float SK_FloatInfinity
constexpr float SK_FloatNegativeInfinity
constexpr bool SkIsPow2(T value)
bool anisoSupport() const
bool clampToBorderSupport() const
bool npotTextureTileSupport() const
static constexpr GrSamplerState Aniso(WrapMode wrapX, WrapMode wrapY, int maxAniso, skgpu::Mipmapped viewIsMipped)
SkISize backingStoreDimensions() const
SkRect backingStoreBoundsRect() const
virtual GrTextureProxy * asTextureProxy()
static constexpr float kInsetEpsilon
GrTextureType textureType() const
skgpu::Mipmapped mipmapped() const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
constexpr bool contains(std::string_view str, std::string_view needle)
SIN Vec< N, float > floor(const Vec< N, float > &x)
SIN Vec< N, float > ceil(const Vec< N, float > &x)
ShaderMode fShaderModes[2]
constexpr int32_t width() const
constexpr int32_t height() const
bool contains(SkScalar x, SkScalar y) const