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(Canvas_quickReject_2, 256, 256, true, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6 SkPoint testPoints[] = {{30, 30}, {120, 30}, {120, 129} };
7 SkPoint clipPoints[] = {{30, 130}, {120, 130}, {120, 230} };
8 SkPath testPath, clipPath;
9 testPath.addPoly(testPoints, std::size(testPoints), true);
10 clipPath.addPoly(clipPoints, std::size(clipPoints), true);
11 canvas->save();
12 canvas->clipPath(clipPath);
13 SkDebugf("quickReject %s\n", canvas->quickReject(testPath) ? "true" : "false");
14 canvas->restore();
15 canvas->rotate(10);
16 canvas->clipPath(clipPath);
17 SkDebugf("quickReject %s\n", canvas->quickReject(testPath) ? "true" : "false");
18 }
19 } // END FIDDLE
20