| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| 11 | 11 |
| 12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014 | 12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014 |
| 13 | 13 |
| 14 static const int kWidth = 640; | 14 static const int kWidth = 640; |
| 15 static const int kHeight = 480; | 15 static const int kHeight = 480; |
| 16 static const SkScalar kAngle = 0.305f; | 16 static const SkScalar kAngle = 0.305f; |
| 17 | 17 |
| 18 // Renders a string art shape. | 18 // Renders a string art shape. |
| 19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t
o 1 | 19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t
o 1 |
| 20 | 20 |
| 21 class StringArtGM : public skiagm::GM { | 21 class StringArtGM : public skiagm::GM { |
| 22 public: | 22 public: |
| 23 StringArtGM() {} | 23 StringArtGM() {} |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 27 return kSkipTiled_Flag; | |
| 28 } | |
| 29 | 26 |
| 30 SkString onShortName() SK_OVERRIDE { | 27 SkString onShortName() SK_OVERRIDE { |
| 31 return SkString("stringart"); | 28 return SkString("stringart"); |
| 32 } | 29 } |
| 33 | 30 |
| 34 SkISize onISize() SK_OVERRIDE { | 31 SkISize onISize() SK_OVERRIDE { |
| 35 return SkISize::Make(kWidth, kHeight); | 32 return SkISize::Make(kWidth, kHeight); |
| 36 } | 33 } |
| 37 | 34 |
| 38 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 35 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 61 paint.setColor(0xFF007700); | 58 paint.setColor(0xFF007700); |
| 62 | 59 |
| 63 canvas->drawPath(path, paint); | 60 canvas->drawPath(path, paint); |
| 64 } | 61 } |
| 65 | 62 |
| 66 private: | 63 private: |
| 67 typedef GM INHERITED; | 64 typedef GM INHERITED; |
| 68 }; | 65 }; |
| 69 | 66 |
| 70 DEF_GM( return new StringArtGM; ) | 67 DEF_GM( return new StringArtGM; ) |
| OLD | NEW |