258 {
259 if (lodX < 1 || lodY < 1 || nullptr == cubics) {
260 return nullptr;
261 }
262
263
264 const int64_t lodX64 = (lodX + 1),
265 lodY64 = (lodY + 1),
266 mult64 = lodX64 * lodY64;
268 return nullptr;
269 }
270
271
272 if (!colorSpace) {
274 }
275
276 int vertexCount =
SkToS32(mult64);
277
278
279 if (vertexCount > 10000 || lodX > 200 || lodY > 200) {
280 float weightX = static_cast<float>(lodX) / (lodX + lodY);
281 float weightY = static_cast<float>(lodY) / (lodX + lodY);
282
283
284
285
288 vertexCount = (lodX + 1) * (lodY + 1);
289 }
290 const int indexCount = lodX * lodY * 6;
292 if (srcTexCoords) {
294 }
295 if (srcColors) {
297 }
298
302
306 uint16_t* indices =
builder.indices();
307
308 if (cornerColors) {
310 }
311
321
322 fBottom.restart(lodX);
323 fTop.restart(lodX);
324
326 int stride = lodY + 1;
327 for (
int x = 0;
x <= lodX;
x++) {
328 SkPoint bottom = fBottom.next(), top = fTop.next();
329 fLeft.restart(lodY);
330 fRight.restart(lodY);
332 for (
int y = 0;
y <= lodY;
y++) {
333 int dataIndex =
x * (lodY + 1) +
y;
334
336
338 (1.0f - v) * top.y() + v * bottom.
y());
342 (1.0f - v) * ((1.0f - u) * fTop.getCtrlPoints()[0].x()
343 + u * fTop.getCtrlPoints()[3].x())
344 + v * ((1.0f - u) * fBottom.getCtrlPoints()[0].x()
345 + u * fBottom.getCtrlPoints()[3].x()),
346 (1.0f - v) * ((1.0f - u) * fTop.getCtrlPoints()[0].y()
347 + u * fTop.getCtrlPoints()[3].y())
348 + v * ((1.0f - u) * fBottom.getCtrlPoints()[0].y()
349 + u * fBottom.getCtrlPoints()[3].y()));
350 pos[dataIndex] = s0 + s1 - s2;
351
352 if (cornerColors) {
357 .store(tmpColors[dataIndex].vec());
358 }
359
362 srcTexCoords[kTopRight_Corner].
x(),
363 srcTexCoords[kBottomLeft_Corner].
x(),
364 srcTexCoords[kBottomRight_Corner].
x()),
365 bilerp(u, v, srcTexCoords[kTopLeft_Corner].
y(),
366 srcTexCoords[kTopRight_Corner].
y(),
367 srcTexCoords[kBottomLeft_Corner].
y(),
368 srcTexCoords[kBottomRight_Corner].
y()));
369
370 }
371
372 if(
x < lodX &&
y < lodY) {
373 int i = 6 * (
x * lodY +
y);
374 indices[
i] =
x * stride +
y;
375 indices[
i + 1] =
x * stride + 1 +
y;
376 indices[
i + 2] = (
x + 1) * stride + 1 +
y;
377 indices[
i + 3] = indices[
i];
378 indices[
i + 4] = indices[
i + 2];
379 indices[
i + 5] = (
x + 1) * stride +
y;
380 }
381 v =
SkTPin(v + 1.f / lodY, 0.0f, 1.0f);
382 }
383 u =
SkTPin(u + 1.f / lodX, 0.0f, 1.0f);
384 }
385
386 if (tmpColors) {
388 }
390}
SkColorSpace * sk_srgb_singleton()
#define sk_float_floor2int_no_saturate(x)
static constexpr int32_t SK_MaxS32
static SkScalar bilerp(SkScalar tx, SkScalar ty, SkScalar c00, SkScalar c10, SkScalar c01, SkScalar c11)
static void skcolor_to_float(SkPMColor4f *dst, const SkColor *src, int count, SkColorSpace *dstCS)
static void float_to_skcolor(SkColor *dst, const SkPMColor4f *src, int count, SkColorSpace *srcCS)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
constexpr int32_t SkToS32(S x)
T * makeArray(size_t count)
@ kHasTexCoords_BuilderFlag
FlutterSemanticsFlag flags
static constexpr SkPoint Make(float x, float y)
constexpr float y() const
constexpr float x() const
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)