blob: 3be59b1ea22fc77c2246c620a1bdaaddef2be0ed [file] [log] [blame]
Brian Salomon5ceda552018-12-14 16:03:38 -05001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner6a34f3a2019-05-01 10:59:30 -04009#include "include/core/SkCanvas.h"
10#include "include/core/SkColor.h"
11#include "include/core/SkPaint.h"
12#include "include/core/SkRect.h"
Brian Salomon5ceda552018-12-14 16:03:38 -050013
14DEF_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}