35#include <initializer_list>
52 return shaderScale == 1 ? grad
70 0, 1, 2, 5, 8, 7, 6, 3, 0
90 texs[1].set(shaderSize / 2, 0);
91 texs[2].set(shaderSize, 0);
92 texs[3].set(0, shaderSize / 2);
93 texs[4].set(shaderSize / 2, shaderSize / 2);
94 texs[5].set(shaderSize, shaderSize / 2);
95 texs[6].set(0, shaderSize);
96 texs[7].set(shaderSize / 2, shaderSize);
97 texs[8].set(shaderSize, shaderSize);
128 if (fShaderScale != 1) {
129 name.append(
"_scaled_shader");
172 for (
auto mode : modes) {
174 for (
float alpha : {1.0f, 0.5f}) {
176 for (
const auto& shader : {fShader1, fShader2}) {
177 static constexpr struct {
180 } kAttrs[] = {{
true,
false}, {
false,
true}, {
true,
true}};
181 for (
auto attrs : kAttrs) {
182 paint.setShader(shader);
183 paint.setColorFilter(cf);
184 paint.setAlphaf(alpha);
186 const SkColor*
colors = attrs.fHasColors ? fColors :
nullptr;
187 const SkPoint*
texs = attrs.fHasTexs ? fTexs :
nullptr;
224 matrices.
append()->reset();
225 matrices.
append()->setTranslate(0, 40);
229 .postTranslate(0, 80);
233 uint16_t* indices =
builder.indices();
234 for (
size_t i = 0;
i < kNumTris; ++
i) {
243 for (
bool useShader : {
false,
true}) {
244 for (
bool useTex : {
false,
true}) {
245 for (
const auto&
m : matrices) {
249 paint.setShader(useShader ? shader :
nullptr);
254 pts, t,
colors, kNumTris * 3, indices);
316 SkPoint verts[] = {{0, 0}, {200, 0}, {200, 200}, {0, 200}};
318 uint16_t indices[] = {0, 1, 2, 2, 3, 0};
335 SkPoint verts[] = {{5, 5}, {45, 5}, {45, 45}, {5, 45}};
337 uint16_t indices[] = {0, 1, 2, 2, 3, 0};
346 paint.setShader(shader);
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clear(SkColor color)
void concat(const SkMatrix &matrix)
void drawVertices(const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
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)
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkMatrix & setPerspY(SkScalar v)
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
sk_sp< SkImage > makeImageSnapshot()
@ kHasTexCoords_BuilderFlag
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
@ kTriangleFan_VertexMode
VerticesGM(SkScalar shaderScale)
SkISize getISize() override
void onOnceBeforeDraw() override
void onDraw(SkCanvas *canvas) override
SkString getName() const override
sk_sp< const SkImage > image
PODArray< SkColor > colors
SK_API sk_sp< SkShader > Color(SkColor)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library name
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 mode
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
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
void toQuad(SkPoint quad[4]) const
constexpr float height() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
DEF_SIMPLE_GM(vertices_batching, canvas, 100, 500)
static sk_sp< SkShader > make_shader1(SkScalar shaderScale)
static sk_sp< SkShader > make_shader2()
static const int kMeshIndexCnt
DEF_SIMPLE_GM_BG(vertices_collapsed, canvas, 50, 50, SK_ColorWHITE)
static void fill_mesh(SkPoint pts[kMeshVertexCnt], SkPoint texs[kMeshVertexCnt], SkColor colors[kMeshVertexCnt], SkScalar shaderScale)
static const int kMeshVertexCnt
static constexpr SkScalar kShaderSize
static constexpr SkScalar kMeshSize
static constexpr uint16_t kMeshFan[]
static sk_sp< SkColorFilter > make_color_filter()
static void draw_batching(SkCanvas *canvas)