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 
8 #include "gm/gm.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkPaint.h"
11 #include "include/core/SkPathBuilder.h"
12 
13 DEF_SIMPLE_GM(crbug_847759, canvas, 500, 500) {
14     // This path exposed an issue in GrAAHairlinePathRenderer. When converting from cubics to quads
15     // we produced quads where the previously vertical tangents at the left and right tips of the
16     // squashed oval-like path became slightly non-vertical. This caused a missed pixel of AA just
17     // outside each tip.
18     SkPathBuilder path;
19     path.moveTo(97,374.5f);
20     path.cubicTo(97,359.8644528f,155.8745488f,348,228.5f,348);
21     path.cubicTo(301.1254512f,348,360,359.8644528f,360,374.5f);
22     path.cubicTo(360,389.1355472f,301.1254512f,401,228.5f,401);
23     path.cubicTo(155.8745488f,401,97,389.1355472f,97,374.5f);
24     path.close();
25     SkPaint paint;
26     paint.setAntiAlias(true);
27     paint.setStrokeWidth(0);
28     paint.setStrokeMiter(1.5);
29     paint.setStyle(SkPaint::kStroke_Style);
30     canvas->translate(-80, -330);
31     canvas->drawPath(path.detach(), paint);
32 }
33