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

Side by Side Diff: gm/thinstrokedrects.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/thinrects.cpp ('k') | gm/tilemodes.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 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 9
10 namespace skiagm { 10 namespace skiagm {
(...skipping 14 matching lines...) Expand all
25 return SkISize::Make(240, 320); 25 return SkISize::Make(240, 320);
26 } 26 }
27 27
28 void onDraw(SkCanvas* canvas) override { 28 void onDraw(SkCanvas* canvas) override {
29 29
30 SkPaint paint; 30 SkPaint paint;
31 paint.setColor(SK_ColorWHITE); 31 paint.setColor(SK_ColorWHITE);
32 paint.setStyle(SkPaint::kStroke_Style); 32 paint.setStyle(SkPaint::kStroke_Style);
33 paint.setAntiAlias(true); 33 paint.setAntiAlias(true);
34 34
35 static const SkRect rect = { 0, 0, 10, 10 }; 35 constexpr SkRect rect = { 0, 0, 10, 10 };
36 static const SkRect rect2 = { 0, 0, 20, 20 }; 36 constexpr SkRect rect2 = { 0, 0, 20, 20 };
37 37
38 static const SkScalar gStrokeWidths[] = { 38 constexpr SkScalar gStrokeWidths[] = {
39 4, 2, 1, 0.5f, 0.25f, 0.125f, 0 39 4, 2, 1, 0.5f, 0.25f, 0.125f, 0
40 }; 40 };
41 41
42 canvas->translate(5, 5); 42 canvas->translate(5, 5);
43 for (int i = 0; i < 8; ++i) { 43 for (int i = 0; i < 8; ++i) {
44 canvas->save(); 44 canvas->save();
45 canvas->translate(i*0.125f, i*30.0f); 45 canvas->translate(i*0.125f, i*30.0f);
46 for (size_t j = 0; j < SK_ARRAY_COUNT(gStrokeWidths); ++j) { 46 for (size_t j = 0; j < SK_ARRAY_COUNT(gStrokeWidths); ++j) {
47 paint.setStrokeWidth(gStrokeWidths[j]); 47 paint.setStrokeWidth(gStrokeWidths[j]);
48 canvas->drawRect(rect, paint); 48 canvas->drawRect(rect, paint);
(...skipping 19 matching lines...) Expand all
68 } 68 }
69 69
70 private: 70 private:
71 typedef GM INHERITED; 71 typedef GM INHERITED;
72 }; 72 };
73 73
74 ////////////////////////////////////////////////////////////////////////////// 74 //////////////////////////////////////////////////////////////////////////////
75 75
76 DEF_GM(return new ThinStrokedRectsGM;) 76 DEF_GM(return new ThinStrokedRectsGM;)
77 } 77 }
OLDNEW
« no previous file with comments | « gm/thinrects.cpp ('k') | gm/tilemodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698