• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=5b31a1b077818a8150ad50f3b19e7bfe
5 REG_FIDDLE(Region_setRect_2, 256, 256, true, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7     auto debugster = [](const char* label, bool success, SkRegion& region) -> void {
8         auto r = region.getBounds();
9         SkDebugf("%14s: success:%s {%d,%d,%d,%d}\n", label, success ? "true" : "false",
10                  r.fLeft, r.fTop, r.fRight, r.fBottom);
11     };
12     SkRegion region;
13     bool success = region.setRect(1, 2, 3, 4);
14     debugster("set to: 1,2,3,4", success, region);
15     success = region.setRect(3, 2, 1, 4);
16     debugster("set to: 3,2,1,4", success, region);
17 }
18 }  // END FIDDLE
19