1 // Copyright 2019 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 // HASH=466ef576b88e29d7252422db7adeed1c
5 REG_FIDDLE(AutoCanvasRestore_SkCanvas_star, 256, 128, false, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7 SkPaint paint;
8 paint.setAntiAlias(true);
9 SkFont font(nullptr, 64);
10 for (SkScalar sx : { -1, 1 } ) {
11 for (SkScalar sy : { -1, 1 } ) {
12 SkAutoCanvasRestore autoRestore(canvas, true);
13 SkMatrix m = SkMatrix::MakeAll(sx, 1, 96, 0, sy, 64, 0, 0, 1);
14 canvas->concat(m);
15 canvas->drawString("R", 0, 0, font, paint);
16 }
17 }
18 }
19 } // END FIDDLE
20