Debian Codegraph @

docs/examples/Path_computeTightBounds.cpp

raw
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(Path_computeTightBounds, 256, 256, true, 0) {
5 void draw(SkCanvas* canvas) {
6 auto debugster = [](const char* prefix, const SkPath& path) -> void {
7 const SkRect& bounds = path.computeTightBounds();
8 SkDebugf("%s bounds = %g, %g, %g, %g\n", prefix,
9 bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
10 };
11 debugster("empty", SkPath());
12 SkPath path = SkPath::Circle(50, 45, 25);
13 debugster("circle", path);
14 SkMatrix matrix;
15 matrix.setRotate(45, 50, 45);
16 path = path.makeTransform(matrix);
17 debugster("rotated circle", path);
18 }
19 } // END FIDDLE