119 {
120 const bool snapToCenter = centerWeight +
fCenterWeight > 0.f;
121 if (snapToCenter) {
122 return {devCenter.
x, devCenter.
y, devCenter.
w};
123 } else {
124
126
127
129 normalizedPos =
scale*normalizedPos - cornerRadii;
130
132
134 if (maxInset.
x < 0.f || maxInset.
y < 0.f) {
135 normalizedPos =
137 - cornerRadii;
138 } else {
139 normalizedPos += localAARadius *
fNormal;
140 }
141 }
142
144 {cornerMapping.
x*normalizedPos.
x + cornerMapping.
y*normalizedPos.
y + cornerPt.
x,
145 cornerMapping.
z*normalizedPos.
x + cornerMapping.
w*normalizedPos.
y + cornerPt.
y};
146 SkV4 devPos =
m.map(localPos.
x, localPos.
y, 0.f, 1.f);
147
148 const bool deviceSpaceNormal =
150 if (deviceSpaceNormal) {
152 {
153
154
155
156
157
158
159
160
161
163
164 float px = cornerMapping.
y*cornerPt.
y - cornerMapping.
w*cornerPt.
x;
165 float py = cornerMapping.
z*cornerPt.
x - cornerMapping.
x*cornerPt.
y;
166
169
172 0.f,
176 0.f,
178
181
183
184
185
186
189 if (normX.
dot(normY) < -0.8) {
190
191
192 float sign = normX.
cross(normY) >= 0.f ? 1.f : -1.f;
195 }
196 }
197
199 }
200
201
202
203
204
207 }
208
209 return SkV3{devPos.
x, devPos.
y, devPos.
w};
210 }
211 }
static SkM44 inv(const SkM44 &m)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr float kMiterScale
static constexpr float kAARadius
static int sign(SkScalar x)
#define SK_ScalarNearlyZero
static float min(float r, float g, float b)
SIN Vec< N, float > normalize(const Vec< N, float > &v)
SkScalar dot(SkV2 v) const
SkScalar cross(SkV2 v) const
SkScalar dot(const SkV4 &v) const