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.
14 // this GM tests hairlines which fill nearly the entire render target
15 class StLouisArchGM : public GM {
17 SkString onShortName() SK_OVERRIDE {
18 return SkString("stlouisarch");
21 SkISize onISize() SK_OVERRIDE { return SkISize::Make((int)kWidth, (int)kHeight); }
23 void onOnceBeforeDraw() SK_OVERRIDE {
25 SkPath* bigQuad = &fPaths.push_back();
26 bigQuad->moveTo(0, 0);
27 bigQuad->quadTo(kWidth/2, kHeight, kWidth, 0);
31 SkPath* degenBigQuad = &fPaths.push_back();
32 SkScalar yPos = kHeight / 2 + 10;
33 degenBigQuad->moveTo(0, yPos);
34 degenBigQuad->quadTo(0, yPos, kWidth, yPos);
39 SkPath* bigCubic = &fPaths.push_back();
40 bigCubic->moveTo(0, 0);
41 bigCubic->cubicTo(0, kHeight,
47 SkPath* degenBigCubic = &fPaths.push_back();
48 SkScalar yPos = kHeight / 2;
49 degenBigCubic->moveTo(0, yPos);
50 degenBigCubic->cubicTo(0, yPos,
56 SkPath* bigConic = &fPaths.push_back();
57 bigConic->moveTo(0, 0);
58 bigConic->conicTo(kWidth/2, kHeight, kWidth, 0, .5);
62 SkPath* degenBigConic = &fPaths.push_back();
63 SkScalar yPos = kHeight / 2 - 10;
64 degenBigConic->moveTo(0, yPos);
65 degenBigConic->conicTo(0, yPos, kWidth, yPos, .5);
69 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
72 canvas->translate(0, -kHeight);
73 for (int p = 0; p < fPaths.count(); ++p) {
75 paint.setARGB(0xff, 0, 0, 0);
76 paint.setAntiAlias(true);
77 paint.setStyle(SkPaint::kStroke_Style);
78 paint.setStrokeWidth(0);
79 canvas->drawPath(fPaths[p], paint);
84 const SkScalar kWidth = 256;
85 const SkScalar kHeight = 256;
88 SkTArray<SkPath> fPaths;
92 //////////////////////////////////////////////////////////////////////////////
94 static GM* MyFactory(void*) { return new StLouisArchGM; }
95 static GMRegistry reg(MyFactory);