| 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 "SkTArray.h" | 10 #include "SkTArray.h" |
| 11 | 11 |
| 12 class ConicPathsGM : public skiagm::GM { | 12 class ConicPathsGM : public skiagm::GM { |
| 13 protected: | 13 protected: |
| 14 | 14 |
| 15 SkString onShortName() SK_OVERRIDE { | 15 SkString onShortName() override { |
| 16 return SkString("conicpaths"); | 16 return SkString("conicpaths"); |
| 17 } | 17 } |
| 18 | 18 |
| 19 SkISize onISize() SK_OVERRIDE { | 19 SkISize onISize() override { |
| 20 return SkISize::Make(920, 960); | 20 return SkISize::Make(920, 960); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void onOnceBeforeDraw() SK_OVERRIDE { | 23 void onOnceBeforeDraw() override { |
| 24 { | 24 { |
| 25 const SkScalar w = SkScalarSqrt(2)/2; | 25 const SkScalar w = SkScalarSqrt(2)/2; |
| 26 SkPath* conicCirlce = &fPaths.push_back(); | 26 SkPath* conicCirlce = &fPaths.push_back(); |
| 27 conicCirlce->moveTo(0, 0); | 27 conicCirlce->moveTo(0, 0); |
| 28 conicCirlce->conicTo(0, 50, 50, 50, w); | 28 conicCirlce->conicTo(0, 50, 50, 50, w); |
| 29 conicCirlce->rConicTo(50, 0, 50, -50, w); | 29 conicCirlce->rConicTo(50, 0, 50, -50, w); |
| 30 conicCirlce->rConicTo(0, -50, -50, -50, w); | 30 conicCirlce->rConicTo(0, -50, -50, -50, w); |
| 31 conicCirlce->rConicTo(-50, 0, -50, 50, w); | 31 conicCirlce->rConicTo(-50, 0, -50, 50, w); |
| 32 | 32 |
| 33 } | 33 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 fGiantCircle.conicTo(2.1e+11f, -2.1e+11f, 2.1e+11f, -1.05e+11f, w); | 81 fGiantCircle.conicTo(2.1e+11f, -2.1e+11f, 2.1e+11f, -1.05e+11f, w); |
| 82 | 82 |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 void drawGiantCircle(SkCanvas* canvas) { | 86 void drawGiantCircle(SkCanvas* canvas) { |
| 87 SkPaint paint; | 87 SkPaint paint; |
| 88 canvas->drawPath(fGiantCircle, paint); | 88 canvas->drawPath(fGiantCircle, paint); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 91 void onDraw(SkCanvas* canvas) override { |
| 92 const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; | 92 const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; |
| 93 | 93 |
| 94 const SkScalar margin = 15; | 94 const SkScalar margin = 15; |
| 95 canvas->translate(margin, margin); | 95 canvas->translate(margin, margin); |
| 96 | 96 |
| 97 SkPaint paint; | 97 SkPaint paint; |
| 98 for (int p = 0; p < fPaths.count(); ++p) { | 98 for (int p = 0; p < fPaths.count(); ++p) { |
| 99 canvas->save(); | 99 canvas->save(); |
| 100 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) { | 100 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) { |
| 101 paint.setARGB(kAlphaValue[a], 0, 0, 0); | 101 paint.setARGB(kAlphaValue[a], 0, 0, 0); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 SkTArray<SkPath> fPaths; | 126 SkTArray<SkPath> fPaths; |
| 127 SkPath fGiantCircle; | 127 SkPath fGiantCircle; |
| 128 typedef skiagm::GM INHERITED; | 128 typedef skiagm::GM INHERITED; |
| 129 }; | 129 }; |
| 130 DEF_GM( return SkNEW(ConicPathsGM); ) | 130 DEF_GM( return SkNEW(ConicPathsGM); ) |
| 131 | 131 |
| 132 ////////////////////////////////////////////////////////////////////////////// | 132 ////////////////////////////////////////////////////////////////////////////// |
| 133 | 133 |
| OLD | NEW |