skia2/gm/b_119394958.cpp
Brian Salomon 5ceda554f5 Fix stroked round capped circular arc batched with filled circle.
A stroked arc with round caps was batched with a filled circle. The circle op
code would choose a GeometryProcessor configuration that expected round cap
centers as vertex attributes. However, the tessellation code for the filled
circle would not put in dummy round cap centers and then didn't advance the
pointer into which vertex data was being written by the expected vertex
stride.

Bug: b/119394958
Change-Id: I6fe95b32d750599e775ed96e656757fe3087795a
Reviewed-on: https://skia-review.googlesource.com/c/177881
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-14 22:11:06 +00:00

28 lines
1.1 KiB
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
DEF_SIMPLE_GM(b_119394958, canvas, 100, 100) {
// The root cause of this bug was that a stroked arc with round caps was batched with a filled
// circle. The circle op code would choose a GeometryProcessor configuration that expected round
// cap centers as vertex attributes. However, the tessellation code for the filled circle would
// not put in dummy round cap centers and then didn't advance the pointer into which vertex data
// was being written by the expected vertex stride.
SkPaint paint;
paint.setColor(SK_ColorBLUE);
paint.setAntiAlias(true);
canvas->drawCircle(50, 50, 45, paint);
paint.setColor(SK_ColorGREEN);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(5);
canvas->drawCircle(50, 50, 35, paint);
paint.setColor(SK_ColorRED);
paint.setStrokeCap(SkPaint::kRound_Cap);
canvas->drawArc(SkRect::MakeLTRB(30, 30, 70, 70), 0, 110, false, paint);
}