| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 problem1->moveTo(SkIntToScalar(4), SkIntToScalar(6)); | 88 problem1->moveTo(SkIntToScalar(4), SkIntToScalar(6)); |
| 89 problem1->cubicTo(SkIntToScalar(5), SkIntToScalar(6), | 89 problem1->cubicTo(SkIntToScalar(5), SkIntToScalar(6), |
| 90 SkIntToScalar(5), SkIntToScalar(4), | 90 SkIntToScalar(5), SkIntToScalar(4), |
| 91 SkIntToScalar(4), SkIntToScalar(0)); | 91 SkIntToScalar(4), SkIntToScalar(0)); |
| 92 problem1->close(); | 92 problem1->close(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 { | 95 { |
| 96 SkPath* problem2 = &fPaths.push_back(); | 96 SkPath* problem2 = &fPaths.push_back(); |
| 97 problem2->moveTo(SkIntToScalar(5), SkIntToScalar(1)); | 97 problem2->moveTo(SkIntToScalar(5), SkIntToScalar(1)); |
| 98 problem2->lineTo(SkFloatToScalar(4.32787323f), SkFloatToScalar(1.672
12653f)); | 98 problem2->lineTo(4.32787323f, 1.67212653f); |
| 99 problem2->cubicTo(SkFloatToScalar(2.75223875f), SkFloatToScalar(3.24
776125f), | 99 problem2->cubicTo(2.75223875f, 3.24776125f, |
| 100 SkFloatToScalar(3.00581908f), SkFloatToScalar(4.51
236057f), | 100 3.00581908f, 4.51236057f, |
| 101 SkFloatToScalar(3.7580452f), SkFloatToScalar(4.373
67964f)); | 101 3.7580452f, 4.37367964f); |
| 102 problem2->cubicTo(SkFloatToScalar(4.66472578f), SkFloatToScalar(3.88
8381f), | 102 problem2->cubicTo(4.66472578f, 3.888381f, |
| 103 SkFloatToScalar(5.f), SkFloatToScalar(2.875f), | 103 5.f, 2.875f, |
| 104 SkFloatToScalar(5.f), SkFloatToScalar(1.f)); | 104 5.f, 1.f); |
| 105 problem2->close(); | 105 problem2->close(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Three paths that show the same bug (missing end caps) | 108 // Three paths that show the same bug (missing end caps) |
| 109 { | 109 { |
| 110 // A caret (crbug.com/131770) | 110 // A caret (crbug.com/131770) |
| 111 SkPath* bug0 = &fPaths.push_back(); | 111 SkPath* bug0 = &fPaths.push_back(); |
| 112 bug0->moveTo(6.5f,5.5f); | 112 bug0->moveTo(6.5f,5.5f); |
| 113 bug0->lineTo(3.5f,0.5f); | 113 bug0->lineTo(3.5f,0.5f); |
| 114 bug0->moveTo(0.5f,5.5f); | 114 bug0->moveTo(0.5f,5.5f); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 SkPath* bug2 = &fPaths.push_back(); | 130 SkPath* bug2 = &fPaths.push_back(); |
| 131 | 131 |
| 132 bug2->moveTo(5.5f, 5.5f); | 132 bug2->moveTo(5.5f, 5.5f); |
| 133 bug2->lineTo(5.5f, 0.5f); | 133 bug2->lineTo(5.5f, 0.5f); |
| 134 bug2->lineTo(0.5f, 0.5f); | 134 bug2->lineTo(0.5f, 0.5f); |
| 135 } | 135 } |
| 136 | 136 |
| 137 { | 137 { |
| 138 // Arc example to test imperfect truncation bug (crbug.com/295626) | 138 // Arc example to test imperfect truncation bug (crbug.com/295626) |
| 139 static const SkScalar kRad = SkIntToScalar(2000); | 139 static const SkScalar kRad = SkIntToScalar(2000); |
| 140 static const SkScalar kStartAngle = SkFloatToScalar(262.59717f); | 140 static const SkScalar kStartAngle = 262.59717f; |
| 141 static const SkScalar kSweepAngle = SkScalarHalf(SkFloatToScalar(17.
188717f)); | 141 static const SkScalar kSweepAngle = SkScalarHalf(17.188717f); |
| 142 | 142 |
| 143 SkPath* bug = &fPaths.push_back(); | 143 SkPath* bug = &fPaths.push_back(); |
| 144 | 144 |
| 145 // Add a circular arc | 145 // Add a circular arc |
| 146 SkRect circle = SkRect::MakeLTRB(-kRad, -kRad, kRad, kRad); | 146 SkRect circle = SkRect::MakeLTRB(-kRad, -kRad, kRad, kRad); |
| 147 bug->addArc(circle, kStartAngle, kSweepAngle); | 147 bug->addArc(circle, kStartAngle, kSweepAngle); |
| 148 | 148 |
| 149 // Now add the chord that should cap the circular arc | 149 // Now add the chord that should cap the circular arc |
| 150 SkScalar cosV, sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle)
, &cosV); | 150 SkScalar cosV, sinV = SkScalarSinCos(SkDegreesToRadians(kStartAngle)
, &cosV); |
| 151 | 151 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 SkTArray<SkPath> fPaths; | 212 SkTArray<SkPath> fPaths; |
| 213 typedef GM INHERITED; | 213 typedef GM INHERITED; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 ////////////////////////////////////////////////////////////////////////////// | 216 ////////////////////////////////////////////////////////////////////////////// |
| 217 | 217 |
| 218 static GM* MyFactory(void*) { return new HairlinesGM; } | 218 static GM* MyFactory(void*) { return new HairlinesGM; } |
| 219 static GMRegistry reg(MyFactory); | 219 static GMRegistry reg(MyFactory); |
| 220 | 220 |
| 221 } | 221 } |
| OLD | NEW |