Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Region_Iterator_rewind.cpp
Go to the documentation of this file.
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.
4// HASH=32d51e959d6cc720a74ec4822511e2cd
5REG_FIDDLE(Region_Iterator_rewind, 256, 256, true, 0) {
6void draw(SkCanvas* canvas) {
7 auto debugster = [](const char* label, SkRegion::Iterator& iter, bool addRewind) -> void {
8 if (addRewind) {
9 bool success = iter.rewind();
10 SkDebugf("%14s rewind success=%s\n", label, success ? "true" : "false");
11 }
12 auto r = iter.rect();
13 SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom);
14 };
16 debugster("empty iter", iter, true);
17 SkRegion region;
18 iter.reset(region);
19 debugster("empty region", iter, true);
20 region.setRect({1, 2, 3, 4});
21 iter.reset(region);
22 debugster("after set rect", iter, false);
23 debugster("after rewind", iter, true);
24}
25} // END FIDDLE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
bool setRect(const SkIRect &rect)
Definition SkRegion.cpp:192
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60