blob: 12cf6384bd5da7ef5438054db1e9e03094b331eb [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3#include "tools/fiddle/examples.h"
4REG_FIDDLE(upscale_checkerboard, 512, 512, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkPMColor p[] = {0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF};
7 const auto info = SkImageInfo::MakeN32Premul(2, 2);
8 auto img = SkImage::MakeRasterCopy({info, p, 8});
9
10 SkPaint paint;
Mike Reedb86cd3d2020-12-10 14:55:43 -050011 paint.setShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
Mike Reed5ec22382021-01-14 21:59:01 -050012 SkSamplingOptions(SkFilterMode::kLinear)));
Hal Canary6c8422c2020-01-10 15:22:09 -050013
14 canvas->translate(20, 20);
15 canvas->scale(20, 20);
16 canvas->drawRect({0, 0, 20, 20}, paint);
17}
18} // END FIDDLE