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(skbug6031, 256, 256, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6 constexpr float kW = 512;
7 constexpr float kH = 512;
8
9 SkPaint paint;
10 static constexpr SkClipOp replaceClipOp = static_cast<SkClipOp>(5);
11
12 canvas->clipRect(SkRect{0, 0, 2 * kW, 2 * kH}, replaceClipOp);
13 paint.setColor(SkColorSetARGB(0, 0, 0, 0));
14 canvas->drawPaint(paint);
15
16 canvas->clipRect(SkRect{0, 0, kW, kH}, replaceClipOp);
17 paint.setColor(SkColorSetARGB(255, 127, 0, 0));
18 canvas->drawPaint(paint);
19
20 canvas->clipRect(SkRect{0, kH, kW, 3 * kH}, replaceClipOp);
21 paint.setColor(SkColorSetARGB(255, 0, 127, 0));
22 canvas->drawPaint(paint);
23
24 canvas->clipRect(SkRect{kW, 0, 3 * kW, kH}, replaceClipOp);
25 paint.setColor(SkColorSetARGB(255, 0, 0, 127));
26 canvas->drawPaint(paint);
27
28 canvas->clipRect(SkRect{kW, kH, 3 * kW, 3 * kH}, replaceClipOp);
29 paint.setColor(SkColorSetARGB(255, 127, 127, 0));
30 canvas->drawPaint(paint);
31 }
32 } // END FIDDLE
33