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 8 #include "gm/gm.h" 9 #include "include/core/SkCanvas.h" 10 #include "include/core/SkPaint.h" 11 #include "include/core/SkPath.h" 12 #include "include/core/SkRect.h" 13 #include "include/core/SkScalar.h" 14 15 DEF_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 } 46