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

Side by Side Diff: gm/beziers.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/beziereffects.cpp ('k') | gm/bigblurs.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 2014 Google Inc. 2 * Copyright 2014 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 "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
11 11
12 #define W 400 12 #define W 400
13 #define H 400 13 #define H 400
14 #define N 10 14 #define N 10
15 15
16 static const SkScalar SH = SkIntToScalar(H); 16 constexpr SkScalar SH = SkIntToScalar(H);
17 17
18 static void rnd_quad(SkPath* p, SkPaint* paint, SkRandom& rand) { 18 static void rnd_quad(SkPath* p, SkPaint* paint, SkRandom& rand) {
19 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H)); 19 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H));
20 for (int x = 0; x < 2; ++x) { 20 for (int x = 0; x < 2; ++x) {
21 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H), 21 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H),
22 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H)); 22 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H));
23 } 23 }
24 paint->setColor(rand.nextU()); 24 paint->setColor(rand.nextU());
25 SkScalar width = rand.nextRangeScalar(1, 5); 25 SkScalar width = rand.nextRangeScalar(1, 5);
26 width *= width; 26 width *= width;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 rnd_cubic(&p, &paint, rand); 74 rnd_cubic(&p, &paint, rand);
75 canvas->drawPath(p, paint); 75 canvas->drawPath(p, paint);
76 } 76 }
77 } 77 }
78 78
79 private: 79 private:
80 typedef skiagm::GM INHERITED; 80 typedef skiagm::GM INHERITED;
81 }; 81 };
82 82
83 DEF_GM( return new BeziersGM; ) 83 DEF_GM( return new BeziersGM; )
OLDNEW
« no previous file with comments | « gm/beziereffects.cpp ('k') | gm/bigblurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698