OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 line(0.00005f, canvas, SK_ColorBLACK); | 186 line(0.00005f, canvas, SK_ColorBLACK); |
187 line(0.000045f, canvas, SK_ColorRED); | 187 line(0.000045f, canvas, SK_ColorRED); |
188 line(0.0000035f, canvas, SK_ColorGREEN); | 188 line(0.0000035f, canvas, SK_ColorGREEN); |
189 line(0.000003f, canvas, SK_ColorBLUE); | 189 line(0.000003f, canvas, SK_ColorBLUE); |
190 line(0.000002f, canvas, SK_ColorBLACK); | 190 line(0.000002f, canvas, SK_ColorBLACK); |
191 } | 191 } |
192 private: | 192 private: |
193 typedef skiagm::GM INHERITED; | 193 typedef skiagm::GM INHERITED; |
194 }; | 194 }; |
195 | 195 |
| 196 DEF_SIMPLE_GM(CubicStroke, canvas, 384, 384) { |
| 197 SkPaint p; |
| 198 p.setAntiAlias(true); |
| 199 p.setStyle(SkPaint::kStroke_Style); |
| 200 p.setStrokeWidth(1.0720f); |
| 201 SkPath path; |
| 202 path.moveTo(-6000,-6000); |
| 203 path.cubicTo(-3500,5500,-500,5500,2500,-6500); |
| 204 canvas->drawPath(path, p); |
| 205 p.setStrokeWidth(1.0721f); |
| 206 canvas->translate(10, 10); |
| 207 canvas->drawPath(path, p); |
| 208 p.setStrokeWidth(1.0722f); |
| 209 canvas->translate(10, 10); |
| 210 canvas->drawPath(path, p); |
| 211 } |
196 | 212 |
197 class Strokes2GM : public skiagm::GM { | 213 class Strokes2GM : public skiagm::GM { |
198 SkPath fPath; | 214 SkPath fPath; |
199 protected: | 215 protected: |
200 void onOnceBeforeDraw() override { | 216 void onOnceBeforeDraw() override { |
201 SkRandom rand; | 217 SkRandom rand; |
202 fPath.moveTo(0, 0); | 218 fPath.moveTo(0, 0); |
203 for (int i = 0; i < 13; i++) { | 219 for (int i = 0; i < 13; i++) { |
204 SkScalar x = rand.nextUScalar1() * (W >> 1); | 220 SkScalar x = rand.nextUScalar1() * (W >> 1); |
205 SkScalar y = rand.nextUScalar1() * (H >> 1); | 221 SkScalar y = rand.nextUScalar1() * (H >> 1); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 static skiagm::GM* F4(void*) { return new Strokes5GM; } | 464 static skiagm::GM* F4(void*) { return new Strokes5GM; } |
449 | 465 |
450 static skiagm::GMRegistry R0(F0); | 466 static skiagm::GMRegistry R0(F0); |
451 static skiagm::GMRegistry R1(F1); | 467 static skiagm::GMRegistry R1(F1); |
452 static skiagm::GMRegistry R2(F2); | 468 static skiagm::GMRegistry R2(F2); |
453 static skiagm::GMRegistry R3(F3); | 469 static skiagm::GMRegistry R3(F3); |
454 static skiagm::GMRegistry R4(F4); | 470 static skiagm::GMRegistry R4(F4); |
455 | 471 |
456 DEF_GM( return new ZeroLenStrokesGM; ) | 472 DEF_GM( return new ZeroLenStrokesGM; ) |
457 DEF_GM( return new TeenyStrokesGM; ) | 473 DEF_GM( return new TeenyStrokesGM; ) |
OLD | NEW |