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" |
11 | 11 |
12 // skbug.com/1316 shows that this cubic, when slightly clipped, creates big | 12 // skbug.com/1316 shows that this cubic, when slightly clipped, creates big |
13 // (incorrect) changes to its control points. | 13 // (incorrect) changes to its control points. |
14 class ClippedCubicGM : public skiagm::GM { | 14 class ClippedCubicGM : public skiagm::GM { |
15 public: | 15 public: |
16 ClippedCubicGM() {} | 16 ClippedCubicGM() {} |
17 | 17 |
18 protected: | 18 protected: |
| 19 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 20 return kSkipTiled_Flag; |
| 21 } |
| 22 |
19 SkString onShortName() { | 23 SkString onShortName() { |
20 return SkString("clippedcubic"); | 24 return SkString("clippedcubic"); |
21 } | 25 } |
22 | 26 |
23 SkISize onISize() { return SkISize::Make(1240, 390); } | 27 SkISize onISize() { return SkISize::Make(1240, 390); } |
24 | 28 |
25 virtual void onDraw(SkCanvas* canvas) { | 29 virtual void onDraw(SkCanvas* canvas) { |
26 SkPath path; | 30 SkPath path; |
27 path.moveTo(0, 0); | 31 path.moveTo(0, 0); |
28 path.cubicTo(140, 150, 40, 10, 170, 150); | 32 path.cubicTo(140, 150, 40, 10, 170, 150); |
(...skipping 19 matching lines...) Expand all Loading... |
48 | 52 |
49 private: | 53 private: |
50 typedef skiagm::GM INHERITED; | 54 typedef skiagm::GM INHERITED; |
51 }; | 55 }; |
52 | 56 |
53 class CubicPathGM : public skiagm::GM { | 57 class CubicPathGM : public skiagm::GM { |
54 public: | 58 public: |
55 CubicPathGM() {} | 59 CubicPathGM() {} |
56 | 60 |
57 protected: | 61 protected: |
| 62 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 63 return kSkipTiled_Flag; |
| 64 } |
| 65 |
58 SkString onShortName() { | 66 SkString onShortName() { |
59 return SkString("cubicpath"); | 67 return SkString("cubicpath"); |
60 } | 68 } |
61 | 69 |
62 SkISize onISize() { return SkISize::Make(1240, 390); } | 70 SkISize onISize() { return SkISize::Make(1240, 390); } |
63 | 71 |
64 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 72 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
65 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 73 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
66 SkPaint::Style style, SkPath::FillType fill, | 74 SkPaint::Style style, SkPath::FillType fill, |
67 SkScalar strokeWidth) { | 75 SkScalar strokeWidth) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 199 |
192 private: | 200 private: |
193 typedef skiagm::GM INHERITED; | 201 typedef skiagm::GM INHERITED; |
194 }; | 202 }; |
195 | 203 |
196 class CubicClosePathGM : public skiagm::GM { | 204 class CubicClosePathGM : public skiagm::GM { |
197 public: | 205 public: |
198 CubicClosePathGM() {} | 206 CubicClosePathGM() {} |
199 | 207 |
200 protected: | 208 protected: |
| 209 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 210 return kSkipTiled_Flag; |
| 211 } |
| 212 |
201 SkString onShortName() { | 213 SkString onShortName() { |
202 return SkString("cubicclosepath"); | 214 return SkString("cubicclosepath"); |
203 } | 215 } |
204 | 216 |
205 SkISize onISize() { return SkISize::Make(1240, 390); } | 217 SkISize onISize() { return SkISize::Make(1240, 390); } |
206 | 218 |
207 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 219 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
208 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 220 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
209 SkPaint::Style style, SkPath::FillType fill, | 221 SkPaint::Style style, SkPath::FillType fill, |
210 SkScalar strokeWidth) { | 222 SkScalar strokeWidth) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 347 |
336 private: | 348 private: |
337 typedef skiagm::GM INHERITED; | 349 typedef skiagm::GM INHERITED; |
338 }; | 350 }; |
339 | 351 |
340 ////////////////////////////////////////////////////////////////////////////// | 352 ////////////////////////////////////////////////////////////////////////////// |
341 | 353 |
342 DEF_GM( return new CubicPathGM; ) | 354 DEF_GM( return new CubicPathGM; ) |
343 DEF_GM( return new CubicClosePathGM; ) | 355 DEF_GM( return new CubicClosePathGM; ) |
344 DEF_GM( return new ClippedCubicGM; ) | 356 DEF_GM( return new ClippedCubicGM; ) |
OLD | NEW |