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

Side by Side Diff: gm/glyph_pos_align.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/glyph_pos.cpp ('k') | gm/gm.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 11
12 /** 12 /**
13 * This test exercises drawPosTextH and drawPosText with every text align. 13 * This test exercises drawPosTextH and drawPosText with every text align.
14 */ 14 */
15 static const int kWidth = 480; 15 constexpr int kWidth = 480;
16 static const int kHeight = 600; 16 constexpr int kHeight = 600;
17 static const SkScalar kTextHeight = 64.0f; 17 constexpr SkScalar kTextHeight = 64.0f;
18 static const int kMaxStringLength = 12; 18 constexpr int kMaxStringLength = 12;
19 19
20 static void drawTestCase(SkCanvas*, const char*, SkScalar, const SkPaint&); 20 static void drawTestCase(SkCanvas*, const char*, SkScalar, const SkPaint&);
21 21
22 DEF_SIMPLE_GM_BG(glyph_pos_align, canvas, kWidth, kHeight, SK_ColorBLACK) { 22 DEF_SIMPLE_GM_BG(glyph_pos_align, canvas, kWidth, kHeight, SK_ColorBLACK) {
23 SkPaint paint; 23 SkPaint paint;
24 paint.setTextSize(kTextHeight); 24 paint.setTextSize(kTextHeight);
25 paint.setFakeBoldText(true); 25 paint.setFakeBoldText(true);
26 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; 26 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
27 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; 27 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}};
28 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_AR RAY_COUNT(colors), 28 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_AR RAY_COUNT(colors),
(...skipping 28 matching lines...) Expand all
57 float x = kTextHeight; 57 float x = kTextHeight;
58 for (int i = 0; i < length; ++i) { 58 for (int i = 0; i < length; ++i) {
59 posX[i] = x + originX * widths[i]; 59 posX[i] = x + originX * widths[i];
60 pos[i].set(posX[i], i ? pos[i - 1].y() + 3 : y + kTextHeight); 60 pos[i].set(posX[i], i ? pos[i - 1].y() + 3 : y + kTextHeight);
61 x += widths[i]; 61 x += widths[i];
62 } 62 }
63 63
64 canvas->drawPosTextH(text, length, posX, y, paint); 64 canvas->drawPosTextH(text, length, posX, y, paint);
65 canvas->drawPosText(text, length, pos, paint); 65 canvas->drawPosText(text, length, pos, paint);
66 } 66 }
OLDNEW
« no previous file with comments | « gm/glyph_pos.cpp ('k') | gm/gm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698