37 kTopP0_CubicCtrlPts = 0,
38 kTopP1_CubicCtrlPts = 1,
39 kTopP2_CubicCtrlPts = 2,
40 kTopP3_CubicCtrlPts = 3,
42 kRightP0_CubicCtrlPts = 3,
43 kRightP1_CubicCtrlPts = 4,
44 kRightP2_CubicCtrlPts = 5,
45 kRightP3_CubicCtrlPts = 6,
47 kBottomP0_CubicCtrlPts = 9,
48 kBottomP1_CubicCtrlPts = 8,
49 kBottomP2_CubicCtrlPts = 7,
50 kBottomP3_CubicCtrlPts = 6,
52 kLeftP0_CubicCtrlPts = 0,
53 kLeftP1_CubicCtrlPts = 11,
54 kLeftP2_CubicCtrlPts = 10,
55 kLeftP3_CubicCtrlPts = 9,
103 fDivisions = divisions;
105 fMax = fDivisions + 1;
112 fFwDiff[1] =
to_point(fCoefs.fA * h3 + fCoefs.fB * h2 + fCoefs.fC *
h);
120 return fCurrent > fMax;
128 fFwDiff[0] += fFwDiff[1];
129 fFwDiff[1] += fFwDiff[2];
130 fFwDiff[2] += fFwDiff[3];
141 int fMax, fCurrent, fDivisions;
142 SkPoint fFwDiff[4], fPoints[4];
159 for (
int i = 0;
i <
count - 1;
i++) {
162 return SkIsFinite(arcLength) ? arcLength : -1;
167 SkScalar a = c00 * (1.f - tx) + c10 * tx;
168 SkScalar b = c01 * (1.f - tx) + c11 * tx;
169 return a * (1.f - ty) +
b * ty;
177 auto a = c00 * (1.f - tx) + c10 * tx;
178 auto b = c01 * (1.f - tx) + c11 * tx;
179 return a * (1.f - ty) +
b * ty;
201 if (topLength < 0 || bottomLength < 0 || leftLength < 0 || rightLength < 0) {
213 points[0] = cubics[kTopP0_CubicCtrlPts];
214 points[1] = cubics[kTopP1_CubicCtrlPts];
215 points[2] = cubics[kTopP2_CubicCtrlPts];
216 points[3] = cubics[kTopP3_CubicCtrlPts];
220 points[0] = cubics[kBottomP0_CubicCtrlPts];
221 points[1] = cubics[kBottomP1_CubicCtrlPts];
222 points[2] = cubics[kBottomP2_CubicCtrlPts];
223 points[3] = cubics[kBottomP3_CubicCtrlPts];
227 points[0] = cubics[kLeftP0_CubicCtrlPts];
228 points[1] = cubics[kLeftP1_CubicCtrlPts];
229 points[2] = cubics[kLeftP2_CubicCtrlPts];
230 points[3] = cubics[kLeftP3_CubicCtrlPts];
234 points[0] = cubics[kRightP0_CubicCtrlPts];
235 points[1] = cubics[kRightP1_CubicCtrlPts];
236 points[2] = cubics[kRightP2_CubicCtrlPts];
237 points[3] = cubics[kRightP3_CubicCtrlPts];
257 const SkPoint srcTexCoords[4],
int lodX,
int lodY,
259 if (lodX < 1 || lodY < 1 ||
nullptr == cubics) {
264 const int64_t lodX64 = (lodX + 1),
266 mult64 = lodX64 * lodY64;
276 int vertexCount =
SkToS32(mult64);
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);
288 vertexCount = (lodX + 1) * (lodY + 1);
290 const int indexCount = lodX * lodY * 6;
306 uint16_t* indices =
builder.indices();
326 int stride = lodY + 1;
327 for (
int x = 0;
x <= lodX;
x++) {
332 for (
int y = 0;
y <= lodY;
y++) {
333 int dataIndex =
x * (lodY + 1) +
y;
338 (1.0f - v) * top.y() + v * bottom.
y());
350 pos[dataIndex] = s0 + s1 - s2;
357 .store(tmpColors[dataIndex].vec());
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()));
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;
381 v =
SkTPin(v + 1.f / lodY, 0.0f, 1.0f);
383 u =
SkTPin(u + 1.f / lodX, 0.0f, 1.0f);
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static const int points[]
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
SkColorSpace * sk_srgb_singleton()
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
bool SkConvertPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB)
#define sk_float_floor2int_no_saturate(x)
static bool SkIsFinite(T x, Pack... values)
static skvx::float2 times_2(const skvx::float2 &value)
static constexpr int32_t SK_MaxS32
static SkScalar bilerp(SkScalar tx, SkScalar ty, SkScalar c00, SkScalar c10, SkScalar c01, SkScalar c11)
static const int kPartitionSize
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 SkScalar approx_arc_length(const SkPoint points[], int count)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
sk_sp< T > sk_ref_sp(T *obj)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
constexpr int32_t SkToS32(S x)
void restart(int divisions)
const SkPoint * getCtrlPoints() const
FwDCubicEvaluator(const SkPoint points[4])
T * makeArray(size_t count)
static sk_sp< SkColorSpace > MakeSRGB()
static void GetTopCubic(const SkPoint cubics[12], SkPoint points[4])
static void GetRightCubic(const SkPoint cubics[12], SkPoint points[4])
static sk_sp< SkVertices > MakeVertices(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY, SkColorSpace *colorSpace=nullptr)
static void GetLeftCubic(const SkPoint cubics[12], SkPoint points[4])
static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix *matrix)
static void GetBottomCubic(const SkPoint cubics[12], SkPoint points[4])
@ kHasTexCoords_BuilderFlag
static SkPoint to_point(SkIPoint p)
FlutterSemanticsFlag flags
static float max(float r, float g, float b)
unsigned useCenter Optional< SkMatrix > matrix
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkPoint Make(float x, float y)
static float Distance(const SkPoint &a, const SkPoint &b)
constexpr float y() const
constexpr float x() const
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)