1// Copyright 2020 Google LLC. 2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3#include "tools/fiddle/examples.h" 4REG_FIDDLE(bug5252, 256, 256, false, 0) { 5void draw(SkCanvas* canvas) { 6 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); 7 8 SkPath clip1; 9 clip1.addOval(SkRect::MakeWH(225, 200)); 10 canvas->clipPath(clip1); // bug 11 12 SkPath clip2; 13 clip2.addRect(SkRect::MakeWH(220, 200)); 14 // canvas->clipPath(clip2); // ok 15 16 SkPaint pa; 17 pa.setStyle(SkPaint::kStroke_Style); 18 pa.setAntiAlias(true); 19 pa.setStrokeWidth(1.0f); 20 for (int i = 0; i < 15; i++) { 21 for (int j = 0; j < 10; j++) { 22 SkAutoCanvasRestore acs(canvas, true); 23 24 canvas->translate(i * 15, j * 20); 25 canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15), pa); 26 SkPath path; 27 path.moveTo(6, 6); 28 path.cubicTo(14, 10, 13, 12, 10, 12); 29 path.cubicTo(7, 15, 8, 17, 14, 18); 30 canvas->drawPath(path, pa); 31 } 32 } 33} 34} // END FIDDLE 35