1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 4cb93a386Sopenharmony_ci// HASH=32d51e959d6cc720a74ec4822511e2cd 5cb93a386Sopenharmony_ciREG_FIDDLE(Region_Iterator_rewind, 256, 256, true, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci auto debugster = [](const char* label, SkRegion::Iterator& iter, bool addRewind) -> void { 8cb93a386Sopenharmony_ci if (addRewind) { 9cb93a386Sopenharmony_ci bool success = iter.rewind(); 10cb93a386Sopenharmony_ci SkDebugf("%14s rewind success=%s\n", label, success ? "true" : "false"); 11cb93a386Sopenharmony_ci } 12cb93a386Sopenharmony_ci auto r = iter.rect(); 13cb93a386Sopenharmony_ci SkDebugf("%14s rect={%d,%d,%d,%d}\n", label, r.fLeft, r.fTop, r.fRight, r.fBottom); 14cb93a386Sopenharmony_ci }; 15cb93a386Sopenharmony_ci SkRegion::Iterator iter; 16cb93a386Sopenharmony_ci debugster("empty iter", iter, true); 17cb93a386Sopenharmony_ci SkRegion region; 18cb93a386Sopenharmony_ci iter.reset(region); 19cb93a386Sopenharmony_ci debugster("empty region", iter, true); 20cb93a386Sopenharmony_ci region.setRect({1, 2, 3, 4}); 21cb93a386Sopenharmony_ci iter.reset(region); 22cb93a386Sopenharmony_ci debugster("after set rect", iter, false); 23cb93a386Sopenharmony_ci debugster("after rewind", iter, true); 24cb93a386Sopenharmony_ci} 25cb93a386Sopenharmony_ci} // END FIDDLE 26