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=fc793a14ed76c096a68a755c963c1ee0
5cb93a386Sopenharmony_ciREG_FIDDLE(Region_setRects, 256, 70, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    SkIRect rects[] = { {10, 10, 40, 40}, {20, 20, 50, 50}, {30, 30, 60, 60} };
8cb93a386Sopenharmony_ci    SkRegion region;
9cb93a386Sopenharmony_ci    region.setRects(rects, SK_ARRAY_COUNT(rects));
10cb93a386Sopenharmony_ci    canvas->drawRegion(region, SkPaint());
11cb93a386Sopenharmony_ci    region.setEmpty();
12cb93a386Sopenharmony_ci    for (auto add : rects) {
13cb93a386Sopenharmony_ci        region.op(add, SkRegion::kUnion_Op);
14cb93a386Sopenharmony_ci    }
15cb93a386Sopenharmony_ci    region.translate(100, 0);
16cb93a386Sopenharmony_ci    canvas->drawRegion(region, SkPaint());
17cb93a386Sopenharmony_ci}
18cb93a386Sopenharmony_ci}  // END FIDDLE
19