| 1 |
// Copyright 2020 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(getLocalBounds_working, 256, 256, true, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkCanvas local(256, 256); |
| 7 |
canvas = &local; |
| 8 |
SkRect bounds = canvas->getLocalClipBounds(); |
| 9 |
SkDebugf("left:%g top:%g right:%g bottom:%g\n", bounds.fLeft, bounds.fTop, bounds.fRight, |
| 10 |
bounds.fBottom); |
| 11 |
SkPoint clipPoints[] = {{30, 130}, {120, 130}, {120, 230}}; |
| 12 |
SkPath clipPath = SkPath::Polygon(clipPoints, true); |
| 13 |
canvas->clipPath(clipPath); |
| 14 |
bounds = canvas->getLocalClipBounds(); |
| 15 |
SkDebugf("left:%g top:%g right:%g bottom:%g\n", bounds.fLeft, bounds.fTop, bounds.fRight, |
| 16 |
bounds.fBottom); |
| 17 |
} |
| 18 |
} // END FIDDLE |