| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 enum ShapeType { | 26 enum ShapeType { |
| 27 kCircle_ShapeType, | 27 kCircle_ShapeType, |
| 28 kRoundRect_ShapeType, | 28 kRoundRect_ShapeType, |
| 29 kRect_ShapeType, | 29 kRect_ShapeType, |
| 30 kConvexPath_ShapeType, | 30 kConvexPath_ShapeType, |
| 31 kConcavePath_ShapeType, | 31 kConcavePath_ShapeType, |
| 32 kText_ShapeType, | 32 kText_ShapeType, |
| 33 kNumShapeTypes | 33 kNumShapeTypes |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 SkString onShortName() SK_OVERRIDE { | 36 SkString onShortName() override { |
| 37 return SkString("dstreadshuffle"); | 37 return SkString("dstreadshuffle"); |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkISize onISize() SK_OVERRIDE { | 40 SkISize onISize() override { |
| 41 return SkISize::Make(kWidth, kHeight); | 41 return SkISize::Make(kWidth, kHeight); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void drawShape(SkCanvas* canvas, | 44 void drawShape(SkCanvas* canvas, |
| 45 SkPaint* paint, | 45 SkPaint* paint, |
| 46 ShapeType type) { | 46 ShapeType type) { |
| 47 static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntTo
Scalar(-50), | 47 static const SkRect kRect = SkRect::MakeXYWH(SkIntToScalar(-50), SkIntTo
Scalar(-50), |
| 48 SkIntToScalar(75), SkIntToS
calar(105)); | 48 SkIntToScalar(75), SkIntToS
calar(105)); |
| 49 switch (type) { | 49 switch (type) { |
| 50 case kCircle_ShapeType: | 50 case kCircle_ShapeType: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 case 1: | 126 case 1: |
| 127 p->setStyle(SkPaint::kStrokeAndFill_Style); | 127 p->setStyle(SkPaint::kStrokeAndFill_Style); |
| 128 p->setStrokeWidth((SkScalar)width); | 128 p->setStrokeWidth((SkScalar)width); |
| 129 break; | 129 break; |
| 130 default: | 130 default: |
| 131 p->setStyle(SkPaint::kFill_Style); | 131 p->setStyle(SkPaint::kFill_Style); |
| 132 break; | 132 break; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 136 void onDraw(SkCanvas* canvas) override { |
| 137 SkRandom random; | 137 SkRandom random; |
| 138 SkScalar y = 100; | 138 SkScalar y = 100; |
| 139 for (int i = 0; i < kNumShapeTypes; i++) { | 139 for (int i = 0; i < kNumShapeTypes; i++) { |
| 140 ShapeType shapeType = static_cast<ShapeType>(i); | 140 ShapeType shapeType = static_cast<ShapeType>(i); |
| 141 SkScalar x = 25; | 141 SkScalar x = 25; |
| 142 for (int style = 0; style < 3; style++) { | 142 for (int style = 0; style < 3; style++) { |
| 143 for (int width = 0; width <= 1; width++) { | 143 for (int width = 0; width <= 1; width++) { |
| 144 for (int alpha = 0; alpha <= 2; alpha++) { | 144 for (int alpha = 0; alpha <= 2; alpha++) { |
| 145 for (int r = 0; r <= 5; r++) { | 145 for (int r = 0; r <= 5; r++) { |
| 146 SkColor color = GetColor(&random, alpha); | 146 SkColor color = GetColor(&random, alpha); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 176 static const int kHeight = 400; | 176 static const int kHeight = 400; |
| 177 typedef GM INHERITED; | 177 typedef GM INHERITED; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 ////////////////////////////////////////////////////////////////////////////// | 180 ////////////////////////////////////////////////////////////////////////////// |
| 181 | 181 |
| 182 static GM* MyFactory(void*) { return new DstReadShuffle; } | 182 static GM* MyFactory(void*) { return new DstReadShuffle; } |
| 183 static GMRegistry reg(MyFactory); | 183 static GMRegistry reg(MyFactory); |
| 184 | 184 |
| 185 } | 185 } |
| OLD | NEW |