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/SkPathBuilder.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 canvas->clipPath(SkPath::Oval(SkRect::MakeWH(225, 200))); // bug 19 20 //canvas->clipPath(SkPath::Oval(SkRect::MakeWH(220, 200))); // ok 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); 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); 38 } 39 } 40 } 41