| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 paint->setColor(rand.nextU()); | 32 paint->setColor(rand.nextU()); |
| 33 paint->setAlpha(0xFF); | 33 paint->setAlpha(0xFF); |
| 34 } | 34 } |
| 35 | 35 |
| 36 | 36 |
| 37 class StrokesGM : public skiagm::GM { | 37 class StrokesGM : public skiagm::GM { |
| 38 public: | 38 public: |
| 39 StrokesGM() {} | 39 StrokesGM() {} |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 43 return kSkipTiled_Flag; |
| 44 } |
| 45 |
| 42 virtual SkString onShortName() { | 46 virtual SkString onShortName() { |
| 43 return SkString("strokes_round"); | 47 return SkString("strokes_round"); |
| 44 } | 48 } |
| 45 | 49 |
| 46 virtual SkISize onISize() { | 50 virtual SkISize onISize() { |
| 47 return SkISize::Make(W, H*2); | 51 return SkISize::Make(W, H*2); |
| 48 } | 52 } |
| 49 | 53 |
| 50 virtual void onDraw(SkCanvas* canvas) { | 54 virtual void onDraw(SkCanvas* canvas) { |
| 51 SkPaint paint; | 55 SkPaint paint; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 SkLCGRandom rand; | 88 SkLCGRandom rand; |
| 85 fPath.moveTo(0, 0); | 89 fPath.moveTo(0, 0); |
| 86 for (int i = 0; i < 13; i++) { | 90 for (int i = 0; i < 13; i++) { |
| 87 SkScalar x = rand.nextUScalar1() * (W >> 1); | 91 SkScalar x = rand.nextUScalar1() * (W >> 1); |
| 88 SkScalar y = rand.nextUScalar1() * (H >> 1); | 92 SkScalar y = rand.nextUScalar1() * (H >> 1); |
| 89 fPath.lineTo(x, y); | 93 fPath.lineTo(x, y); |
| 90 } | 94 } |
| 91 } | 95 } |
| 92 | 96 |
| 93 protected: | 97 protected: |
| 98 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 99 return kSkipTiled_Flag; |
| 100 } |
| 101 |
| 94 virtual SkString onShortName() { | 102 virtual SkString onShortName() { |
| 95 return SkString("strokes_poly"); | 103 return SkString("strokes_poly"); |
| 96 } | 104 } |
| 97 | 105 |
| 98 virtual SkISize onISize() { | 106 virtual SkISize onISize() { |
| 99 return SkISize::Make(W, H*2); | 107 return SkISize::Make(W, H*2); |
| 100 } | 108 } |
| 101 | 109 |
| 102 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { | 110 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { |
| 103 SkMatrix matrix; | 111 SkMatrix matrix; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 SkRect r = bounds; | 189 SkRect r = bounds; |
| 182 r.inset(bounds.width() / 10, -bounds.height() / 10); | 190 r.inset(bounds.width() / 10, -bounds.height() / 10); |
| 183 path->addOval(r, SkPath::kCCW_Direction); | 191 path->addOval(r, SkPath::kCCW_Direction); |
| 184 title->set("CW CCW"); | 192 title->set("CW CCW"); |
| 185 } | 193 } |
| 186 | 194 |
| 187 public: | 195 public: |
| 188 Strokes3GM() {} | 196 Strokes3GM() {} |
| 189 | 197 |
| 190 protected: | 198 protected: |
| 199 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 200 return kSkipTiled_Flag; |
| 201 } |
| 202 |
| 191 virtual SkString onShortName() { | 203 virtual SkString onShortName() { |
| 192 return SkString("strokes3"); | 204 return SkString("strokes3"); |
| 193 } | 205 } |
| 194 | 206 |
| 195 virtual SkISize onISize() { | 207 virtual SkISize onISize() { |
| 196 return SkISize::Make(W, H*2); | 208 return SkISize::Make(W, H*2); |
| 197 } | 209 } |
| 198 | 210 |
| 199 virtual void onDraw(SkCanvas* canvas) { | 211 virtual void onDraw(SkCanvas* canvas) { |
| 200 SkPaint origPaint; | 212 SkPaint origPaint; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 253 |
| 242 ////////////////////////////////////////////////////////////////////////////// | 254 ////////////////////////////////////////////////////////////////////////////// |
| 243 | 255 |
| 244 static skiagm::GM* F0(void*) { return new StrokesGM; } | 256 static skiagm::GM* F0(void*) { return new StrokesGM; } |
| 245 static skiagm::GM* F1(void*) { return new Strokes2GM; } | 257 static skiagm::GM* F1(void*) { return new Strokes2GM; } |
| 246 static skiagm::GM* F2(void*) { return new Strokes3GM; } | 258 static skiagm::GM* F2(void*) { return new Strokes3GM; } |
| 247 | 259 |
| 248 static skiagm::GMRegistry R0(F0); | 260 static skiagm::GMRegistry R0(F0); |
| 249 static skiagm::GMRegistry R1(F1); | 261 static skiagm::GMRegistry R1(F1); |
| 250 static skiagm::GMRegistry R2(F2); | 262 static skiagm::GMRegistry R2(F2); |
| OLD | NEW |