OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 closedQuad->moveTo(0, -0); | 73 closedQuad->moveTo(0, -0); |
74 closedQuad->quadTo(SkIntToScalar(100), SkIntToScalar(100), 0, 0); | 74 closedQuad->quadTo(SkIntToScalar(100), SkIntToScalar(100), 0, 0); |
75 } | 75 } |
76 | 76 |
77 { | 77 { |
78 SkPath* unevenClosedQuad = &fPaths.push_back(); | 78 SkPath* unevenClosedQuad = &fPaths.push_back(); |
79 unevenClosedQuad->moveTo(0, -0); | 79 unevenClosedQuad->moveTo(0, -0); |
80 unevenClosedQuad->quadTo(SkIntToScalar(100), SkIntToScalar(100), | 80 unevenClosedQuad->quadTo(SkIntToScalar(100), SkIntToScalar(100), |
81 SkIntToScalar(75), SkIntToScalar(75)); | 81 SkIntToScalar(75), SkIntToScalar(75)); |
82 } | 82 } |
| 83 |
| 84 // Two problem cases for gpu hairline renderer found by shapeops testing
. These used |
| 85 // to assert that the computed bounding box didn't contain all the verti
ces. |
| 86 { |
| 87 SkPath* problem1 = &fPaths.push_back(); |
| 88 problem1->moveTo(SkIntToScalar(4), SkIntToScalar(6)); |
| 89 problem1->cubicTo(SkIntToScalar(5), SkIntToScalar(6), |
| 90 SkIntToScalar(5), SkIntToScalar(4), |
| 91 SkIntToScalar(4), SkIntToScalar(0)); |
| 92 problem1->close(); |
| 93 } |
| 94 |
| 95 { |
| 96 SkPath* problem2 = &fPaths.push_back(); |
| 97 problem2->moveTo(SkIntToScalar(5), SkIntToScalar(1)); |
| 98 problem2->lineTo(SkFloatToScalar(4.32787323f), SkFloatToScalar(1.672
12653f)); |
| 99 problem2->cubicTo(SkFloatToScalar(2.75223875f), SkFloatToScalar(3.24
776125f), |
| 100 SkFloatToScalar(3.00581908f), SkFloatToScalar(4.51
236057f), |
| 101 SkFloatToScalar(3.7580452f), SkFloatToScalar(4.373
67964f)); |
| 102 problem2->cubicTo(SkFloatToScalar(4.66472578f), SkFloatToScalar(3.88
8381f), |
| 103 SkFloatToScalar(5.f), SkFloatToScalar(2.875f), |
| 104 SkFloatToScalar(5.f), SkFloatToScalar(1.f)); |
| 105 problem2->close(); |
| 106 } |
83 } | 107 } |
84 | 108 |
85 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 109 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
86 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; | 110 static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; |
87 | 111 |
88 enum { | 112 enum { |
89 kMargin = 5, | 113 kMargin = 5, |
90 }; | 114 }; |
91 int wrapX = canvas->getDeviceSize().fWidth - kMargin; | 115 int wrapX = canvas->getDeviceSize().fWidth - kMargin; |
92 | 116 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 SkTArray<SkPath> fPaths; | 158 SkTArray<SkPath> fPaths; |
135 typedef GM INHERITED; | 159 typedef GM INHERITED; |
136 }; | 160 }; |
137 | 161 |
138 ////////////////////////////////////////////////////////////////////////////// | 162 ////////////////////////////////////////////////////////////////////////////// |
139 | 163 |
140 static GM* MyFactory(void*) { return new HairlinesGM; } | 164 static GM* MyFactory(void*) { return new HairlinesGM; } |
141 static GMRegistry reg(MyFactory); | 165 static GMRegistry reg(MyFactory); |
142 | 166 |
143 } | 167 } |
OLD | NEW |