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 uint32_t onGetFlags() const SK_OVERRIDE { | |
20 return kSkipTiled_Flag; | |
21 } | |
22 | 19 |
23 SkString onShortName() { | 20 SkString onShortName() { |
24 return SkString("clippedcubic"); | 21 return SkString("clippedcubic"); |
25 } | 22 } |
26 | 23 |
27 SkISize onISize() { return SkISize::Make(1240, 390); } | 24 SkISize onISize() { return SkISize::Make(1240, 390); } |
28 | 25 |
29 virtual void onDraw(SkCanvas* canvas) { | 26 virtual void onDraw(SkCanvas* canvas) { |
30 SkPath path; | 27 SkPath path; |
31 path.moveTo(0, 0); | 28 path.moveTo(0, 0); |
(...skipping 20 matching lines...) Expand all Loading... |
52 | 49 |
53 private: | 50 private: |
54 typedef skiagm::GM INHERITED; | 51 typedef skiagm::GM INHERITED; |
55 }; | 52 }; |
56 | 53 |
57 class CubicPathGM : public skiagm::GM { | 54 class CubicPathGM : public skiagm::GM { |
58 public: | 55 public: |
59 CubicPathGM() {} | 56 CubicPathGM() {} |
60 | 57 |
61 protected: | 58 protected: |
62 uint32_t onGetFlags() const SK_OVERRIDE { | |
63 return kSkipTiled_Flag; | |
64 } | |
65 | 59 |
66 SkString onShortName() { | 60 SkString onShortName() { |
67 return SkString("cubicpath"); | 61 return SkString("cubicpath"); |
68 } | 62 } |
69 | 63 |
70 SkISize onISize() { return SkISize::Make(1240, 390); } | 64 SkISize onISize() { return SkISize::Make(1240, 390); } |
71 | 65 |
72 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 66 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
73 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 67 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
74 SkPaint::Style style, SkPath::FillType fill, | 68 SkPaint::Style style, SkPath::FillType fill, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 195 |
202 private: | 196 private: |
203 typedef skiagm::GM INHERITED; | 197 typedef skiagm::GM INHERITED; |
204 }; | 198 }; |
205 | 199 |
206 class CubicClosePathGM : public skiagm::GM { | 200 class CubicClosePathGM : public skiagm::GM { |
207 public: | 201 public: |
208 CubicClosePathGM() {} | 202 CubicClosePathGM() {} |
209 | 203 |
210 protected: | 204 protected: |
211 uint32_t onGetFlags() const SK_OVERRIDE { | |
212 return kSkipTiled_Flag; | |
213 } | |
214 | 205 |
215 SkString onShortName() { | 206 SkString onShortName() { |
216 return SkString("cubicclosepath"); | 207 return SkString("cubicclosepath"); |
217 } | 208 } |
218 | 209 |
219 SkISize onISize() { return SkISize::Make(1240, 390); } | 210 SkISize onISize() { return SkISize::Make(1240, 390); } |
220 | 211 |
221 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 212 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
222 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 213 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
223 SkPaint::Style style, SkPath::FillType fill, | 214 SkPaint::Style style, SkPath::FillType fill, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 342 |
352 private: | 343 private: |
353 typedef skiagm::GM INHERITED; | 344 typedef skiagm::GM INHERITED; |
354 }; | 345 }; |
355 | 346 |
356 ////////////////////////////////////////////////////////////////////////////// | 347 ////////////////////////////////////////////////////////////////////////////// |
357 | 348 |
358 DEF_GM( return new CubicPathGM; ) | 349 DEF_GM( return new CubicPathGM; ) |
359 DEF_GM( return new CubicClosePathGM; ) | 350 DEF_GM( return new CubicClosePathGM; ) |
360 DEF_GM( return new ClippedCubicGM; ) | 351 DEF_GM( return new ClippedCubicGM; ) |
OLD | NEW |