Chris Dalton | c096654 | 2019-09-23 20:16:03 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google LLC. |
| 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" |
Mike Reed | 06d7c9d | 2020-08-26 12:56:51 -0400 | [diff] [blame] | 10 | #include "include/core/SkPathBuilder.h" |
Chris Dalton | c096654 | 2019-09-23 20:16:03 -0600 | [diff] [blame] | 11 | |
| 12 | // Repro case for http://skbug.com/9453 |
| 13 | DEF_SIMPLE_GM(inverseclip, canvas, 400, 400) { |
Mike Reed | 06d7c9d | 2020-08-26 12:56:51 -0400 | [diff] [blame] | 14 | SkPathBuilder clip; |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 15 | clip.setFillType(SkPathFillType::kInverseWinding); |
Chris Dalton | c096654 | 2019-09-23 20:16:03 -0600 | [diff] [blame] | 16 | clip.moveTo(195.448f, 31); |
| 17 | clip.cubicTo(97.9925f, 31, 18.99f, 105.23f, 18.99f, 196.797f); |
| 18 | clip.cubicTo(18.99f, 288.365f, 97.9925f, 362.595f, 195.448f, 362.595f); |
| 19 | clip.cubicTo(292.905f, 362.595f, 371.905f, 288.365f, 371.905f, 196.797f); |
| 20 | clip.cubicTo(371.905f, 105.23f, 292.905f, 31, 195.448f, 31); |
| 21 | clip.close(); |
Mike Reed | 06d7c9d | 2020-08-26 12:56:51 -0400 | [diff] [blame] | 22 | canvas->clipPath(clip.detach(), true); |
Chris Dalton | c096654 | 2019-09-23 20:16:03 -0600 | [diff] [blame] | 23 | |
| 24 | SkPaint paint; |
| 25 | paint.setColor(SK_ColorBLUE); |
| 26 | canvas->drawRect(SkRect::MakeWH(400, 400), paint); |
| 27 | } |