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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 SkISize onISize() { return SkISize::Make(1240, 390); } | 23 SkISize onISize() { return SkISize::Make(1240, 390); } |
24 | 24 |
25 virtual void onDraw(SkCanvas* canvas) { | 25 virtual void onDraw(SkCanvas* canvas) { |
26 SkPath path; | 26 SkPath path; |
27 path.moveTo(0, 0); | 27 path.moveTo(0, 0); |
28 path.cubicTo(140, 150, 40, 10, 170, 150); | 28 path.cubicTo(140, 150, 40, 10, 170, 150); |
29 | 29 |
30 SkPaint paint; | 30 SkPaint paint; |
31 SkRect bounds = path.getBounds(); | 31 SkRect bounds = path.getBounds(); |
32 | 32 |
33 for (int dy = -1; dy <= 1; ++dy) { | 33 for (SkScalar dy = -1; dy <= 1; dy += 1) { |
34 canvas->save(); | 34 canvas->save(); |
35 for (int dx = -1; dx <= 1; ++dx) { | 35 for (SkScalar dx = -1; dx <= 1; dx += 1) { |
36 canvas->save(); | 36 canvas->save(); |
37 canvas->clipRect(bounds); | 37 canvas->clipRect(bounds); |
38 canvas->translate(dx, dy); | 38 canvas->translate(dx, dy); |
39 canvas->drawPath(path, paint); | 39 canvas->drawPath(path, paint); |
40 canvas->restore(); | 40 canvas->restore(); |
41 | 41 |
42 canvas->translate(bounds.width(), 0); | 42 canvas->translate(bounds.width(), 0); |
43 } | 43 } |
44 canvas->restore(); | 44 canvas->restore(); |
45 canvas->translate(0, bounds.height()); | 45 canvas->translate(0, bounds.height()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 private: | 336 private: |
337 typedef skiagm::GM INHERITED; | 337 typedef skiagm::GM INHERITED; |
338 }; | 338 }; |
339 | 339 |
340 ////////////////////////////////////////////////////////////////////////////// | 340 ////////////////////////////////////////////////////////////////////////////// |
341 | 341 |
342 DEF_GM( return new CubicPathGM; ) | 342 DEF_GM( return new CubicPathGM; ) |
343 DEF_GM( return new CubicClosePathGM; ) | 343 DEF_GM( return new CubicClosePathGM; ) |
344 DEF_GM( return new ClippedCubicGM; ) | 344 DEF_GM( return new ClippedCubicGM; ) |
OLD | NEW |