| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 path.cubicTo(-3500,5500,-500,5500,2500,-6500); | 203 path.cubicTo(-3500,5500,-500,5500,2500,-6500); |
| 204 canvas->drawPath(path, p); | 204 canvas->drawPath(path, p); |
| 205 p.setStrokeWidth(1.0721f); | 205 p.setStrokeWidth(1.0721f); |
| 206 canvas->translate(10, 10); | 206 canvas->translate(10, 10); |
| 207 canvas->drawPath(path, p); | 207 canvas->drawPath(path, p); |
| 208 p.setStrokeWidth(1.0722f); | 208 p.setStrokeWidth(1.0722f); |
| 209 canvas->translate(10, 10); | 209 canvas->translate(10, 10); |
| 210 canvas->drawPath(path, p); | 210 canvas->drawPath(path, p); |
| 211 } | 211 } |
| 212 | 212 |
| 213 DEF_SIMPLE_GM(zerolinestroke, canvas, 90, 120) { |
| 214 SkPaint paint; |
| 215 paint.setStyle(SkPaint::kStroke_Style); |
| 216 paint.setStrokeWidth(20); |
| 217 paint.setAntiAlias(true); |
| 218 paint.setStrokeCap(SkPaint::kRound_Cap); |
| 219 |
| 220 SkPath path; |
| 221 path.moveTo(30, 90); |
| 222 path.lineTo(30, 90); |
| 223 path.lineTo(60, 90); |
| 224 path.lineTo(60, 90); |
| 225 canvas->drawPath(path, paint); |
| 226 |
| 227 path.reset(); |
| 228 path.moveTo(30, 30); |
| 229 path.lineTo(60, 30); |
| 230 canvas->drawPath(path, paint); |
| 231 |
| 232 path.reset(); |
| 233 path.moveTo(30, 60); |
| 234 path.lineTo(30, 60); |
| 235 path.lineTo(60, 60); |
| 236 canvas->drawPath(path, paint); |
| 237 } |
| 238 |
| 213 class Strokes2GM : public skiagm::GM { | 239 class Strokes2GM : public skiagm::GM { |
| 214 SkPath fPath; | 240 SkPath fPath; |
| 215 protected: | 241 protected: |
| 216 void onOnceBeforeDraw() override { | 242 void onOnceBeforeDraw() override { |
| 217 SkRandom rand; | 243 SkRandom rand; |
| 218 fPath.moveTo(0, 0); | 244 fPath.moveTo(0, 0); |
| 219 for (int i = 0; i < 13; i++) { | 245 for (int i = 0; i < 13; i++) { |
| 220 SkScalar x = rand.nextUScalar1() * (W >> 1); | 246 SkScalar x = rand.nextUScalar1() * (W >> 1); |
| 221 SkScalar y = rand.nextUScalar1() * (H >> 1); | 247 SkScalar y = rand.nextUScalar1() * (H >> 1); |
| 222 fPath.lineTo(x, y); | 248 fPath.lineTo(x, y); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 static skiagm::GM* F4(void*) { return new Strokes5GM; } | 490 static skiagm::GM* F4(void*) { return new Strokes5GM; } |
| 465 | 491 |
| 466 static skiagm::GMRegistry R0(F0); | 492 static skiagm::GMRegistry R0(F0); |
| 467 static skiagm::GMRegistry R1(F1); | 493 static skiagm::GMRegistry R1(F1); |
| 468 static skiagm::GMRegistry R2(F2); | 494 static skiagm::GMRegistry R2(F2); |
| 469 static skiagm::GMRegistry R3(F3); | 495 static skiagm::GMRegistry R3(F3); |
| 470 static skiagm::GMRegistry R4(F4); | 496 static skiagm::GMRegistry R4(F4); |
| 471 | 497 |
| 472 DEF_GM( return new ZeroLenStrokesGM; ) | 498 DEF_GM( return new ZeroLenStrokesGM; ) |
| 473 DEF_GM( return new TeenyStrokesGM; ) | 499 DEF_GM( return new TeenyStrokesGM; ) |
| OLD | NEW |