Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Side by Side Diff: gm/strokerect.cpp

Issue 2300623005: Replace a lot of 'static const' with 'constexpr' or 'const'. (Closed)
Patch Set: small msvc concession Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/strokedlines.cpp ('k') | gm/strokerects.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/strokedlines.cpp ('k') | gm/strokerects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698