351 {
352
353
354
355
356
358
359 {{kConcatBeforeClips, kDoesntMatter, kNoLocalMat},
360 {kConcatAfterClips, kDoesntMatter, kBothWithLocalMat}},
361
362 {{kConcatBetweenClips, kClipGradientFirst, kNoLocalMat},
363 {kConcatAfterClips, kDoesntMatter, kImageWithLocalMat}},
364
365 {{kConcatBetweenClips, kClipImageFirst, kNoLocalMat},
366 {kConcatAfterClips, kDoesntMatter, kGradientWithLocalMat}}
367 };
368
369
371
373
377 {img->width() + 28.f, -100.f},
378 {img->width() - 28.f, img->height() + 100.f},
379 {0.f, img->height() - 80.f}};
382
384
385 auto drawConfig = [&](
Config config) {
386 canvas->save();
387
388 draw_banner(canvas, config);
389
390
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;
400
401
402 if (config.fConcat == kConcatBeforeClips) {
403 canvas->concat(persp);
404 }
405
406
407 canvas->clipShader(config.fOrder == kClipImageFirst ? imgShader : gradShader);
408
409
410 if (config.fConcat == kConcatBetweenClips) {
411 canvas->concat(persp);
412 }
413
414
415 canvas->clipShader(config.fOrder == kClipImageFirst ? gradShader : imgShader);
416
417
418 if (config.fConcat == kConcatAfterClips) {
419 canvas->concat(persp);
420 }
421
422
423 canvas->clipIRect(img->bounds());
425 canvas->drawImage(img, 0, 0);
426
427 canvas->restore();
428 };
429
432
433 canvas->translate(10.f, 10.f);
434
435 for (size_t i = 0; i < std::size(matches); ++i) {
436 canvas->save();
437 canvas->translate(-grid.
fLeft, -grid.
fTop);
438 drawConfig(matches[i][0]);
439 canvas->translate(0.f, grid.
height());
440 drawConfig(matches[i][1]);
441 canvas->restore();
442
443 canvas->translate(grid.
width(), 0.f);
444 }
445}
#define SkAssertResult(cond)
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
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 SkRect Make(const SkISize &size)
void toQuad(SkPoint quad[4]) const