caryclark | 4cba202 | 2016-05-12 07:07:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkCanvas.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 10 | #include "include/core/SkPaint.h" |
Mike Reed | 15a5403 | 2020-08-16 11:15:41 -0400 | [diff] [blame] | 11 | #include "include/core/SkPathBuilder.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/core/SkRect.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 13 | #include "include/core/SkScalar.h" |
caryclark | 4cba202 | 2016-05-12 07:07:05 -0700 | [diff] [blame] | 14 | |
| 15 | DEF_SIMPLE_GM(bug5252, canvas, 500, 500) { |
| 16 | canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
| 17 | |
Mike Reed | 92f6eb1 | 2020-08-25 11:48:41 -0400 | [diff] [blame] | 18 | canvas->clipPath(SkPath::Oval(SkRect::MakeWH(225, 200))); // bug |
caryclark | 4cba202 | 2016-05-12 07:07:05 -0700 | [diff] [blame] | 19 | |
Mike Reed | 92f6eb1 | 2020-08-25 11:48:41 -0400 | [diff] [blame] | 20 | //canvas->clipPath(SkPath::Oval(SkRect::MakeWH(220, 200))); // ok |
caryclark | 4cba202 | 2016-05-12 07:07:05 -0700 | [diff] [blame] | 21 | |
| 22 | SkPaint pa; |
| 23 | pa.setStyle(SkPaint::kStroke_Style); |
| 24 | pa.setAntiAlias(true); |
| 25 | pa.setStrokeWidth(1.0f); |
| 26 | for (int i = 0; i < 15; i++) |
| 27 | { |
| 28 | for (int j = 0; j < 10; j++) |
| 29 | { |
| 30 | SkAutoCanvasRestore acs(canvas, true); |
| 31 | |
| 32 | canvas->translate(i * 15.f, j * 20.f); |
| 33 | canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15),pa); |
Mike Reed | 15a5403 | 2020-08-16 11:15:41 -0400 | [diff] [blame] | 34 | canvas->drawPath(SkPathBuilder().moveTo(6, 6) |
| 35 | .cubicTo(14, 10, 13, 12, 10, 12) |
| 36 | .cubicTo(7, 15, 8, 17, 14, 18) |
| 37 | .detach(), pa); |
caryclark | 4cba202 | 2016-05-12 07:07:05 -0700 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | } |