Brian Salomon | 5ceda55 | 2018-12-14 16:03:38 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 9 | #include "include/core/SkCanvas.h" |
| 10 | #include "include/core/SkColor.h" |
| 11 | #include "include/core/SkPaint.h" |
| 12 | #include "include/core/SkRect.h" |
Brian Salomon | 5ceda55 | 2018-12-14 16:03:38 -0500 | [diff] [blame] | 13 | |
| 14 | DEF_SIMPLE_GM(b_119394958, canvas, 100, 100) { |
| 15 | // The root cause of this bug was that a stroked arc with round caps was batched with a filled |
| 16 | // circle. The circle op code would choose a GeometryProcessor configuration that expected round |
| 17 | // cap centers as vertex attributes. However, the tessellation code for the filled circle would |
| 18 | // not put in dummy round cap centers and then didn't advance the pointer into which vertex data |
| 19 | // was being written by the expected vertex stride. |
| 20 | SkPaint paint; |
| 21 | paint.setColor(SK_ColorBLUE); |
| 22 | paint.setAntiAlias(true); |
| 23 | canvas->drawCircle(50, 50, 45, paint); |
| 24 | paint.setColor(SK_ColorGREEN); |
| 25 | paint.setStyle(SkPaint::kStroke_Style); |
| 26 | paint.setStrokeWidth(5); |
| 27 | canvas->drawCircle(50, 50, 35, paint); |
| 28 | paint.setColor(SK_ColorRED); |
| 29 | paint.setStrokeCap(SkPaint::kRound_Cap); |
| 30 | canvas->drawArc(SkRect::MakeLTRB(30, 30, 70, 70), 0, 110, false, paint); |
| 31 | } |