blob: 884db795b6c604b336b4ffb352180c4942351a50 [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 Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkPath.h"
12#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
18 SkPath clip1;
19 clip1.addOval(SkRect::MakeWH(225, 200));
20 canvas->clipPath(clip1); // bug
21
22 SkPath clip2;
23 clip2.addRect(SkRect::MakeWH(220, 200));
24 //canvas->clipPath(clip2); // ok
25
26 SkPaint pa;
27 pa.setStyle(SkPaint::kStroke_Style);
28 pa.setAntiAlias(true);
29 pa.setStrokeWidth(1.0f);
30 for (int i = 0; i < 15; i++)
31 {
32 for (int j = 0; j < 10; j++)
33 {
34 SkAutoCanvasRestore acs(canvas, true);
35
36 canvas->translate(i * 15.f, j * 20.f);
37 canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15),pa);
38 SkPath path;
39 path.moveTo(6, 6);
40 path.cubicTo(14, 10, 13, 12, 10, 12);
41 path.cubicTo(7, 15, 8, 17, 14, 18);
42 canvas->drawPath(path, pa);
43 }
44 }
45}