24#include <initializer_list>
55 matrices.
append()->setAll(1.f, 0.f, 0.f,
58 matrices.
append()->setAll(1.f, 0.f, 0.f,
60 0.007f, -0.005f, 1.f);
61 matrices[1].preSkew(0.2f, -0.1f);
62 matrices[1].preRotate(-65.f);
63 matrices[1].preScale(1.2f, .8f);
64 matrices[1].postTranslate(0.f, 60.f);
68 for (
const auto& img : fImages) {
70 for (
const auto&
m : matrices) {
72 m.mapRect(&temp, imgB);
84 {DrawType::kDrawImage, DrawType::kDrawImageRectStrict, DrawType::kDrawImageRectFast}) {
85 for (
const auto&
m : matrices) {
86 for (
auto aa : {
false,
true}) {
87 paint.setAntiAlias(aa);
93 for (
const auto& origImage : fImages) {
99 3.f * img->
width() / 4.f, 3.f * img->
height() / 4 };
101 3.f / 4.f * img->
width(), 3.f / 4.f * img->
height()};
103 case DrawType::kDrawImage:
106 case DrawType::kDrawImageRectStrict:
110 case DrawType::kDrawImageRectFast:
135 inline static constexpr int kNumImages = 4;
138 using INHERITED =
GM;
143DEF_GM(
return new PerspImages();)
void translate(SkScalar dx, SkScalar dy)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
@ kFast_SrcRectConstraint
sample outside bounds; faster
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void concat(const SkMatrix &matrix)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
GM(SkColor backgroundColor=SK_ColorWHITE)
SkISize getISize() override
SkString getName() const override
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
Optional< SkRect > bounds
SkSamplingOptions sampling
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
SkSamplingOptions(SkFilterMode::kLinear))
static sk_sp< SkImage > make_image2()
static sk_sp< SkImage > make_image1()
static constexpr SkCubicResampler Mitchell()
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeEmpty()
static constexpr SkRect MakeWH(float w, float h)