42 , fDoSaveLayer(saveLayer)
43 , fInvertDraw(invertDraw) {
50 str.
printf(
"complexclip_%s%s%s",
51 fDoAAClip ?
"aa" :
"bw",
52 fDoSaveLayer ?
"_layer" :
"",
53 fInvertDraw ?
"_invert" :
"");
66 .
quadTo(200, 200, 150, 200)
72 .
quadTo(150, 150, 125, 150)
85 SkPath clipA =
SkPath::Polygon({{10, 20}, {165, 22}, {70, 105}, {165, 177}, {-5, 180}},
true);
87 SkPath clipB =
SkPath::Polygon({{40, 10}, {190, 15}, {195, 190}, {40, 185}, {155, 100}},
true);
109 4.0f/3.0f * (this->
getISize().fWidth - 20),
110 4.0f/3.0f * (this->
getISize().fHeight - 20));
121 for (
int invBits = 0; invBits < 4; ++invBits) {
123 for (
size_t op = 0; op <
std::size(gOps); ++op) {
124 this->drawHairlines(canvas,
path, clipA, clipB);
126 bool doInvA =
SkToBool(invBits & 1);
127 bool doInvB =
SkToBool(invBits & 2);
135 canvas->
clipPath(clipB, gOps[op].fOp, fDoAAClip);
155 const char* aTxt = doInvA ?
"InvA " :
"A ";
163 const char* bTxt = doInvB ?
"InvB " :
"B ";
180 paint.setAntiAlias(
true);
199 using INHERITED =
GM;
204DEF_GM(
return new ComplexClipGM(
false,
false,
false);)
205DEF_GM(
return new ComplexClipGM(
false,
false,
true);)
206DEF_GM(
return new ComplexClipGM(
false,
true,
false);)
207DEF_GM(
return new ComplexClipGM(
false,
true,
true);)
208DEF_GM(
return new ComplexClipGM(
true,
false,
false);)
209DEF_GM(
return new ComplexClipGM(
true,
false,
true);)
210DEF_GM(
return new ComplexClipGM(
true,
true,
false);)
211DEF_GM(
return new ComplexClipGM(
true,
true,
true);)
232 canvas->
translate(0, img->height() + 10);
239 canvas->
translate(img->width() + 10, img->height() + 10);
280 canvas->
scale(2.f, 2.f);
297enum ConcatPerspective {
308 kDoesntMatter = kClipImageFirst
314 kGradientWithLocalMat,
318 ConcatPerspective fConcat;
327 if (config.fConcat == kConcatBeforeClips || config.fLM == kBothWithLocalMat) {
328 banner.
append(
"Both Clips");
330 SkASSERT((config.fConcat == kConcatBetweenClips && config.fLM == kNoLocalMat) ||
331 (config.fConcat == kConcatAfterClips && (config.fLM == kImageWithLocalMat ||
332 config.fLM == kGradientWithLocalMat)));
333 if ((config.fConcat == kConcatBetweenClips && config.fOrder == kClipImageFirst) ||
334 config.fLM == kGradientWithLocalMat) {
335 banner.
append(
"Gradient");
337 SkASSERT(config.fOrder == kClipGradientFirst || config.fLM == kImageWithLocalMat);
341 if (config.fLM != kNoLocalMat) {
342 banner.
append(
" (w/ LM, should equal top row)");
359 {{kConcatBeforeClips, kDoesntMatter, kNoLocalMat},
360 {kConcatAfterClips, kDoesntMatter, kBothWithLocalMat}},
362 {{kConcatBetweenClips, kClipGradientFirst, kNoLocalMat},
363 {kConcatAfterClips, kDoesntMatter, kImageWithLocalMat}},
365 {{kConcatBetweenClips, kClipImageFirst, kNoLocalMat},
366 {kConcatAfterClips, kDoesntMatter, kGradientWithLocalMat}}
377 {img->width() + 28.f, -100.f},
378 {img->width() - 28.f, img->height() + 100.f},
379 {0.f, img->height() - 80.f}};
385 auto drawConfig = [&](
Config config) {
388 draw_banner(canvas, config);
391 bool gradLM = config.fLM == kGradientWithLocalMat || config.fLM == kBothWithLocalMat;
394 0.1f * img->width(), gradColors,
nullptr, 2,
396 gradLM ? &persp :
nullptr);
397 bool imageLM = config.fLM == kImageWithLocalMat || config.fLM == kBothWithLocalMat;
402 if (config.fConcat == kConcatBeforeClips) {
407 canvas->
clipShader(config.fOrder == kClipImageFirst ? imgShader : gradShader);
410 if (config.fConcat == kConcatBetweenClips) {
415 canvas->
clipShader(config.fOrder == kClipImageFirst ? gradShader : imgShader);
418 if (config.fConcat == kConcatAfterClips) {
459 paint.setAntiAlias(
true);
484 path.moveTo(0.f, 128.f);
485 path.lineTo(128.f, 256.f);
486 path.lineTo(256.f, 128.f);
487 path.lineTo(128.f, 0.f);
490 path.moveTo(128.f -
d, 128.f -
d);
491 path.lineTo(128.f -
d, 128.f +
d);
492 path.lineTo(128.f +
d, 128.f +
d);
493 path.lineTo(128.f +
d, 128.f -
d);
503 for (
int y = 0;
y < 4; ++
y) {
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static constexpr bool SkToBool(const T &x)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clipIRect(const SkIRect &irect, SkClipOp op=SkClipOp::kIntersect)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void clear(SkColor color)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
void drawPath(const SkPath &path, const SkPaint &paint)
void scale(SkScalar sx, SkScalar sy)
void concat(const SkMatrix &matrix)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void clipShader(sk_sp< SkShader >, SkClipOp=SkClipOp::kIntersect)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, 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 RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & quadTo(SkPoint pt1, SkPoint pt2)
void setFillType(SkPathFillType ft)
const SkRect & getBounds() const
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
void printf(const char format[],...) SK_PRINTF_LIKE(2
void append(const char text[])
const char * c_str() const
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
SkString getName() const override
ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw)
GM(SkColor backgroundColor=SK_ColorWHITE)
DEF_SIMPLE_GM(clip_shader, canvas, 840, 650)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< SkBlender > blender SkRect rect
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
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
font
Font Metadata and Metrics.
SK_API sk_sp< PrecompileShader > LocalMatrix(SkSpan< const sk_sp< PrecompileShader > > wrapped)
constexpr SkColor gPathColor
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
SkSamplingOptions(SkFilterMode::kLinear))
constexpr SkColor gClipBColor
constexpr SkColor gClipAColor
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
int32_t fLeft
smaller x-axis bounds
static constexpr SkISize Make(int32_t w, int32_t h)
static SkRect Make(const SkISize &size)
void toQuad(SkPoint quad[4]) const
static SkRect MakeIWH(int w, int h)
void outset(float dx, float dy)
void join(const SkRect &r)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)