355 {
359 };
360 static const Varying kVaryings[]{
362 };
363 static constexpr char kPremulVS[] = R"(
364 Varyings main(const in Attributes attributes) {
365 Varyings varyings;
366 varyings.color = half4(attributes.color.a*attributes.color.rgb,
367 attributes.color.a);
368 varyings.position = attributes.pos;
369 return varyings;
370 }
371 )";
372 static constexpr char kUnpremulVS[] = R"(
373 Varyings main(const in Attributes attributes) {
374 Varyings varyings;
375 varyings.color = attributes.color;
376 varyings.position = attributes.pos;
377 return varyings;
378 }
379 )";
380 static constexpr char kFS[] = R"(
381 float2 main(in const Varyings varyings, out half4 color) {
382 color = varyings.color;
383 return varyings.position;
384 }
385 )";
386 for (bool unpremul : {false, true}) {
388 auto vs = unpremul ? kUnpremulVS : kPremulVS;
389 for (
bool spin : {
false,
true}) {
392 cs = cs->makeColorSpin();
393 }
394
398 kVaryings,
401 std::move(cs),
402 at);
403 if (!spec) {
405 }
406 fSpecs[SpecIndex(unpremul,
spin)] = std::move(spec);
407 }
408 }
409 SkPoint pts[] = {{kRect.fLeft, 0}, {kRect.centerX(), 0}};
412
414 }
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
constexpr SkColor SK_ColorTRANSPARENT
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static Result Make(SkSpan< const Attribute > attributes, size_t vertexStride, SkSpan< const Varying > varyings, const SkString &vs, const SkString &fs)
const uint8_t uint32_t uint32_t GError ** error
SK_API sk_sp< SkMesh::VertexBuffer > MakeVertexBuffer(const void *, size_t size)
PODArray< SkColor > colors
static const std::map< std::string, VerticesBuilder::AttributeType > kAttributes