| 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 namespace skiagm { | 12 namespace skiagm { |
| 13 | 13 |
| 14 class QuadPathGM : public GM { | 14 class QuadPathGM : public GM { |
| 15 public: | 15 public: |
| 16 QuadPathGM() {} | 16 QuadPathGM() {} |
| 17 | 17 |
| 18 protected: | 18 protected: |
| 19 | 19 |
| 20 SkString onShortName() SK_OVERRIDE { | 20 SkString onShortName() override { |
| 21 return SkString("quadpath"); | 21 return SkString("quadpath"); |
| 22 } | 22 } |
| 23 | 23 |
| 24 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1240, 390); } | 24 SkISize onISize() override { return SkISize::Make(1240, 390); } |
| 25 | 25 |
| 26 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 26 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
| 27 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 27 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
| 28 SkPaint::Style style, SkPath::FillType fill, | 28 SkPaint::Style style, SkPath::FillType fill, |
| 29 SkScalar strokeWidth) { | 29 SkScalar strokeWidth) { |
| 30 path.setFillType(fill); | 30 path.setFillType(fill); |
| 31 SkPaint paint; | 31 SkPaint paint; |
| 32 paint.setStrokeCap(cap); | 32 paint.setStrokeCap(cap); |
| 33 paint.setStrokeWidth(strokeWidth); | 33 paint.setStrokeWidth(strokeWidth); |
| 34 paint.setStrokeJoin(join); | 34 paint.setStrokeJoin(join); |
| 35 paint.setColor(color); | 35 paint.setColor(color); |
| 36 paint.setStyle(style); | 36 paint.setStyle(style); |
| 37 canvas->save(); | 37 canvas->save(); |
| 38 canvas->clipRect(clip); | 38 canvas->clipRect(clip); |
| 39 canvas->drawPath(path, paint); | 39 canvas->drawPath(path, paint); |
| 40 canvas->restore(); | 40 canvas->restore(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 43 void onDraw(SkCanvas* canvas) override { |
| 44 struct FillAndName { | 44 struct FillAndName { |
| 45 SkPath::FillType fFill; | 45 SkPath::FillType fFill; |
| 46 const char* fName; | 46 const char* fName; |
| 47 }; | 47 }; |
| 48 static const FillAndName gFills[] = { | 48 static const FillAndName gFills[] = { |
| 49 {SkPath::kWinding_FillType, "Winding"}, | 49 {SkPath::kWinding_FillType, "Winding"}, |
| 50 {SkPath::kEvenOdd_FillType, "Even / Odd"}, | 50 {SkPath::kEvenOdd_FillType, "Even / Odd"}, |
| 51 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, | 51 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, |
| 52 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, | 52 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, |
| 53 }; | 53 }; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 private: | 155 private: |
| 156 typedef GM INHERITED; | 156 typedef GM INHERITED; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 class QuadClosePathGM : public GM { | 159 class QuadClosePathGM : public GM { |
| 160 public: | 160 public: |
| 161 QuadClosePathGM() {} | 161 QuadClosePathGM() {} |
| 162 | 162 |
| 163 protected: | 163 protected: |
| 164 | 164 |
| 165 SkString onShortName() SK_OVERRIDE { | 165 SkString onShortName() override { |
| 166 return SkString("quadclosepath"); | 166 return SkString("quadclosepath"); |
| 167 } | 167 } |
| 168 | 168 |
| 169 SkISize onISize() SK_OVERRIDE { return SkISize::Make(1240, 390); } | 169 SkISize onISize() override { return SkISize::Make(1240, 390); } |
| 170 | 170 |
| 171 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, | 171 void drawPath(SkPath& path,SkCanvas* canvas,SkColor color, |
| 172 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, | 172 const SkRect& clip,SkPaint::Cap cap, SkPaint::Join join, |
| 173 SkPaint::Style style, SkPath::FillType fill, | 173 SkPaint::Style style, SkPath::FillType fill, |
| 174 SkScalar strokeWidth) { | 174 SkScalar strokeWidth) { |
| 175 path.setFillType(fill); | 175 path.setFillType(fill); |
| 176 SkPaint paint; | 176 SkPaint paint; |
| 177 paint.setStrokeCap(cap); | 177 paint.setStrokeCap(cap); |
| 178 paint.setStrokeWidth(strokeWidth); | 178 paint.setStrokeWidth(strokeWidth); |
| 179 paint.setStrokeJoin(join); | 179 paint.setStrokeJoin(join); |
| 180 paint.setColor(color); | 180 paint.setColor(color); |
| 181 paint.setStyle(style); | 181 paint.setStyle(style); |
| 182 canvas->save(); | 182 canvas->save(); |
| 183 canvas->clipRect(clip); | 183 canvas->clipRect(clip); |
| 184 canvas->drawPath(path, paint); | 184 canvas->drawPath(path, paint); |
| 185 canvas->restore(); | 185 canvas->restore(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 188 void onDraw(SkCanvas* canvas) override { |
| 189 struct FillAndName { | 189 struct FillAndName { |
| 190 SkPath::FillType fFill; | 190 SkPath::FillType fFill; |
| 191 const char* fName; | 191 const char* fName; |
| 192 }; | 192 }; |
| 193 static const FillAndName gFills[] = { | 193 static const FillAndName gFills[] = { |
| 194 {SkPath::kWinding_FillType, "Winding"}, | 194 {SkPath::kWinding_FillType, "Winding"}, |
| 195 {SkPath::kEvenOdd_FillType, "Even / Odd"}, | 195 {SkPath::kEvenOdd_FillType, "Even / Odd"}, |
| 196 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, | 196 {SkPath::kInverseWinding_FillType, "Inverse Winding"}, |
| 197 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, | 197 {SkPath::kInverseEvenOdd_FillType, "Inverse Even / Odd"}, |
| 198 }; | 198 }; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 ////////////////////////////////////////////////////////////////////////////// | 305 ////////////////////////////////////////////////////////////////////////////// |
| 306 | 306 |
| 307 static GM* QuadPathFactory(void*) { return new QuadPathGM; } | 307 static GM* QuadPathFactory(void*) { return new QuadPathGM; } |
| 308 static GMRegistry regQuadPath(QuadPathFactory); | 308 static GMRegistry regQuadPath(QuadPathFactory); |
| 309 | 309 |
| 310 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } | 310 static GM* QuadClosePathFactory(void*) { return new QuadClosePathGM; } |
| 311 static GMRegistry regQuadClosePath(QuadClosePathFactory); | 311 static GMRegistry regQuadClosePath(QuadClosePathFactory); |
| 312 | 312 |
| 313 } | 313 } |
| OLD | NEW |