blob: 2109b90e0b2603fa8713eba744adc3fa0870b195 [file] [log] [blame]
caryclarkfeff7d22014-10-09 05:36:03 -07001/*
2 * Copyright 2014 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.h"
bungemand3ebb482015-08-05 13:57:49 -07009#include "SkPath.h"
caryclarkfeff7d22014-10-09 05:36:03 -070010
11namespace skiagm {
12
13// this draws a small arc scaled up
14// see https://code.google.com/p/chromium/issues/detail?id=102411
15// and https://code.google.com/p/skia/issues/detail?id=2769
16class SmallArcGM : public GM {
17public:
18 SmallArcGM() {
19 }
20
21protected:
22
mtklein36352bf2015-03-25 18:17:31 -070023 SkString onShortName() override {
caryclarkfeff7d22014-10-09 05:36:03 -070024 return SkString("smallarc");
25 }
26
mtklein36352bf2015-03-25 18:17:31 -070027 SkISize onISize() override {
caryclarkfeff7d22014-10-09 05:36:03 -070028 return SkISize::Make(762, 762);
29 }
30
mtklein36352bf2015-03-25 18:17:31 -070031 void onDraw(SkCanvas* canvas) override {
caryclarkfeff7d22014-10-09 05:36:03 -070032 SkPaint p;
33 p.setColor(SK_ColorRED);
34 p.setAntiAlias(true);
35 p.setStyle(SkPaint::kStroke_Style);
36 p.setStrokeWidth(120);
37
38 SkPath path;
39 path.moveTo(75, 0);
40 path.cubicTo(33.5, 0, 0, 33.5, 0, 75);
41
42 canvas->translate(-400, -400);
43 canvas->scale(8, 8);
44 canvas->drawPath(path, p);
45 }
46
47private:
48 typedef GM INHERITED;
49};
50
51//////////////////////////////////////////////////////////////////////////////
52
53DEF_GM( return SkNEW(SmallArcGM); )
54
55}