| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 void onDraw(SkCanvas* canvas) override { | 58 void onDraw(SkCanvas* canvas) override { |
| 59 canvas->drawColor(SK_ColorWHITE); | 59 canvas->drawColor(SK_ColorWHITE); |
| 60 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2); | 60 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2); |
| 61 | 61 |
| 62 SkPaint paint; | 62 SkPaint paint; |
| 63 paint.setStyle(SkPaint::kStroke_Style); | 63 paint.setStyle(SkPaint::kStroke_Style); |
| 64 paint.setStrokeWidth(STROKE_WIDTH); | 64 paint.setStrokeWidth(STROKE_WIDTH); |
| 65 | 65 |
| 66 static const SkPaint::Join gJoins[] = { | 66 constexpr SkPaint::Join gJoins[] = { |
| 67 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join | 67 SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 static const SkScalar W = 80; | 70 constexpr SkScalar W = 80; |
| 71 static const SkScalar H = 80; | 71 constexpr SkScalar H = 80; |
| 72 static const SkRect gRects[] = { | 72 constexpr SkRect gRects[] = { |
| 73 { 0, 0, W, H }, | 73 { 0, 0, W, H }, |
| 74 { W, 0, 0, H }, | 74 { W, 0, 0, H }, |
| 75 { 0, H, W, 0 }, | 75 { 0, H, W, 0 }, |
| 76 { 0, 0, STROKE_WIDTH, H }, | 76 { 0, 0, STROKE_WIDTH, H }, |
| 77 { 0, 0, W, STROKE_WIDTH }, | 77 { 0, 0, W, STROKE_WIDTH }, |
| 78 { 0, 0, STROKE_WIDTH/2, STROKE_WIDTH/2 }, | 78 { 0, 0, STROKE_WIDTH/2, STROKE_WIDTH/2 }, |
| 79 { 0, 0, W, 0 }, | 79 { 0, 0, W, 0 }, |
| 80 { 0, 0, 0, H }, | 80 { 0, 0, 0, H }, |
| 81 { 0, 0, 0, 0 }, | 81 { 0, 0, 0, 0 }, |
| 82 { 0, 0, W, FLT_EPSILON }, | 82 { 0, 0, W, FLT_EPSILON }, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 */ | 120 */ |
| 121 DEF_SIMPLE_GM(strokerect_anisotropic_5408, canvas, 200, 50) { | 121 DEF_SIMPLE_GM(strokerect_anisotropic_5408, canvas, 200, 50) { |
| 122 SkPaint p; | 122 SkPaint p; |
| 123 p.setStyle(SkPaint::kStroke_Style); | 123 p.setStyle(SkPaint::kStroke_Style); |
| 124 p.setStrokeWidth(6); | 124 p.setStrokeWidth(6); |
| 125 | 125 |
| 126 canvas->scale(10, 1); | 126 canvas->scale(10, 1); |
| 127 SkRect r = SkRect::MakeXYWH(5, 20, 10, 10); | 127 SkRect r = SkRect::MakeXYWH(5, 20, 10, 10); |
| 128 canvas->drawRect(r, p); | 128 canvas->drawRect(r, p); |
| 129 } | 129 } |
| OLD | NEW |