| 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(bug5252, 256, 256, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
| 7 |
|
| 8 |
SkPath clip1 = SkPath::Oval(SkRect::MakeWH(225, 200)); |
| 9 |
canvas->clipPath(clip1); // bug |
| 10 |
|
| 11 |
SkPath clip2 = SkPath::Rect(SkRect::MakeWH(220, 200)); |
| 12 |
// canvas->clipPath(clip2); // ok |
| 13 |
|
| 14 |
SkPaint pa; |
| 15 |
pa.setStyle(SkPaint::kStroke_Style); |
| 16 |
pa.setAntiAlias(true); |
| 17 |
pa.setStrokeWidth(1.0f); |
| 18 |
for (int i = 0; i < 15; i++) { |
| 19 |
for (int j = 0; j < 10; j++) { |
| 20 |
SkAutoCanvasRestore acs(canvas, true); |
| 21 |
|
| 22 |
canvas->translate(i * 15, j * 20); |
| 23 |
canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15), pa); |
| 24 |
SkPathBuilder path; |
| 25 |
path.moveTo(6, 6); |
| 26 |
path.cubicTo(14, 10, 13, 12, 10, 12); |
| 27 |
path.cubicTo(7, 15, 8, 17, 14, 18); |
| 28 |
canvas->drawPath(path.detach(), pa); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
} // END FIDDLE |