2 * Copyright 2015 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
15 // this GM tests hairlines which fill nearly the entire render target
16 class StLouisArchGM : public GM {
18 SkString onShortName() override {
19 return SkString("stlouisarch");
22 SkISize onISize() override { return SkISize::Make((int)kWidth, (int)kHeight); }
24 void onOnceBeforeDraw() override {
26 SkPath* bigQuad = &fPaths.push_back();
27 bigQuad->moveTo(0, 0);
28 bigQuad->quadTo(kWidth/2, kHeight, kWidth, 0);
32 SkPath* degenBigQuad = &fPaths.push_back();
33 SkScalar yPos = kHeight / 2 + 10;
34 degenBigQuad->moveTo(0, yPos);
35 degenBigQuad->quadTo(0, yPos, kWidth, yPos);
40 SkPath* bigCubic = &fPaths.push_back();
41 bigCubic->moveTo(0, 0);
42 bigCubic->cubicTo(0, kHeight,
48 SkPath* degenBigCubic = &fPaths.push_back();
49 SkScalar yPos = kHeight / 2;
50 degenBigCubic->moveTo(0, yPos);
51 degenBigCubic->cubicTo(0, yPos,
57 SkPath* bigConic = &fPaths.push_back();
58 bigConic->moveTo(0, 0);
59 bigConic->conicTo(kWidth/2, kHeight, kWidth, 0, .5);
63 SkPath* degenBigConic = &fPaths.push_back();
64 SkScalar yPos = kHeight / 2 - 10;
65 degenBigConic->moveTo(0, yPos);
66 degenBigConic->conicTo(0, yPos, kWidth, yPos, .5);
70 void onDraw(SkCanvas* canvas) override {
73 canvas->translate(0, -kHeight);
74 for (int p = 0; p < fPaths.count(); ++p) {
76 paint.setARGB(0xff, 0, 0, 0);
77 paint.setAntiAlias(true);
78 paint.setStyle(SkPaint::kStroke_Style);
79 paint.setStrokeWidth(0);
80 canvas->drawPath(fPaths[p], paint);
85 const SkScalar kWidth = 256;
86 const SkScalar kHeight = 256;
89 SkTArray<SkPath> fPaths;
93 //////////////////////////////////////////////////////////////////////////////
95 static GM* MyFactory(void*) { return new StLouisArchGM; }
96 static GMRegistry reg(MyFactory);