blob: 7b3a223ad7d5960ece25b4454dc01699332afe5c [file] [log] [blame]
caryclark4cba2022016-05-12 07:07:05 -07001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
9#include "include/core/SkCanvas.h"
Ben Wagner6a34f3a2019-05-01 10:59:30 -040010#include "include/core/SkPaint.h"
Mike Reed15a54032020-08-16 11:15:41 -040011#include "include/core/SkPathBuilder.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050012#include "include/core/SkRect.h"
Ben Wagner6a34f3a2019-05-01 10:59:30 -040013#include "include/core/SkScalar.h"
caryclark4cba2022016-05-12 07:07:05 -070014
15DEF_SIMPLE_GM(bug5252, canvas, 500, 500) {
16 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
17
Mike Reed92f6eb12020-08-25 11:48:41 -040018 canvas->clipPath(SkPath::Oval(SkRect::MakeWH(225, 200))); // bug
caryclark4cba2022016-05-12 07:07:05 -070019
Mike Reed92f6eb12020-08-25 11:48:41 -040020 //canvas->clipPath(SkPath::Oval(SkRect::MakeWH(220, 200))); // ok
caryclark4cba2022016-05-12 07:07:05 -070021
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 Reed15a54032020-08-16 11:15:41 -040034 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);
caryclark4cba2022016-05-12 07:07:05 -070038 }
39 }
40}