37 return surface->makeImageSnapshot();
85 fPath.
lineTo(kCellSize/2.0f, kCellSize/2.0f);
111 canvas->
concat(fPerspMatrix);
112 canvas->
drawImageRect(fBitmapImage, r, sampling, &filterPaint);
117 canvas->
concat(fPerspMatrix);
118 canvas->
drawImage(fImage.
get(), 0, 0, sampling, &filterPaint);
123 canvas->
concat(fPerspMatrix);
129 canvas->
concat(fPerspMatrix);
135 canvas->
concat(fPerspMatrix);
141 canvas->
concat(fPerspMatrix);
142 canvas->
drawPath(fPath, gradPaint2);
150 fImage =
make_image(canvas, kCellSize, kCellSize);
166 inline static constexpr int kCellSize = 50;
167 inline static constexpr int kNumRows = 5;
168 inline static constexpr int kNumCols = 6;
178 using INHERITED =
GM;
180DEF_GM(
return new PerspShadersGM(
true);)
181DEF_GM(
return new PerspShadersGM(
false);)
197 for (
int i = 0; i < 4; ++i) {
199 for (
auto& p : pts) {
202 path.moveTo(pts[0]).quadTo(pts[1], pts[2]).quadTo(pts[3], pts[4]).lineTo(pts[5]);
213 paint.setColor({0.75, 0.75, 0.75, 1});
214 canvas->drawPath(path,
paint);
221 -1.7866f, 1.3357f, 273.0295f,
222 -1.0820f, 1.3186f, 135.5196f,
223 -0.0047f, -0.0015f, 2.1485f,
227 paint.setShader(shader);
229 canvas->drawPath(path,
paint);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
static SkPoint rand_pt(SkRandom &rand)
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawPath(const SkPath &path, const SkPaint &paint)
void concat(const SkMatrix &matrix)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
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
virtual bool isValid(GrRecordingContext *context) const =0
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkMatrix & set9(const SkScalar buffer[9])
SkMatrix & setPerspY(SkScalar v)
void setAntiAlias(bool aa)
void setShader(sk_sp< SkShader > shader)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
void printf(const char format[],...) SK_PRINTF_LIKE(2
void onDraw(SkCanvas *canvas) override
void onOnceBeforeDraw() override
SkString getName() const override
void drawRow(SkCanvas *canvas, const SkSamplingOptions &sampling)
SkISize getISize() override
PerspShadersGM(bool doAA)
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static sk_sp< SkImage > make_image()
static SkPath make_path()
static constexpr SkCubicResampler Mitchell()
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkSamplingOptions Aniso(int maxAniso)