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