1 // 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"
4 REG_FIDDLE(upscale_checkerboard, 512, 512, false, 0) {
draw(SkCanvas * canvas)5 void 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;
11     paint.setShader(img->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
12                                     SkSamplingOptions(SkFilterMode::kLinear)));
13 
14     canvas->translate(20, 20);
15     canvas->scale(20, 20);
16     canvas->drawRect({0, 0, 20, 20}, paint);
17 }
18 }  // END FIDDLE
19