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

Side by Side Diff: gm/gm.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_align.cpp ('k') | gm/gradientDirtyLaundry.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 2011 Google Inc. 2 * Copyright 2011 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 "SkShader.h" 9 #include "SkShader.h"
10 using namespace skiagm; 10 using namespace skiagm;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void GM::DrawGpuOnlyMessage(SkCanvas* canvas) { 73 void GM::DrawGpuOnlyMessage(SkCanvas* canvas) {
74 SkBitmap bmp; 74 SkBitmap bmp;
75 bmp.allocN32Pixels(128, 64); 75 bmp.allocN32Pixels(128, 64);
76 SkCanvas bmpCanvas(bmp); 76 SkCanvas bmpCanvas(bmp);
77 bmpCanvas.drawColor(SK_ColorWHITE); 77 bmpCanvas.drawColor(SK_ColorWHITE);
78 SkPaint paint; 78 SkPaint paint;
79 paint.setAntiAlias(true); 79 paint.setAntiAlias(true);
80 paint.setTextSize(20); 80 paint.setTextSize(20);
81 paint.setColor(SK_ColorRED); 81 paint.setColor(SK_ColorRED);
82 sk_tool_utils::set_portable_typeface(&paint); 82 sk_tool_utils::set_portable_typeface(&paint);
83 static const char kTxt[] = "GPU Only"; 83 constexpr char kTxt[] = "GPU Only";
84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); 84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint);
85 SkMatrix localM; 85 SkMatrix localM;
86 localM.setRotate(35.f); 86 localM.setRotate(35.f);
87 localM.postTranslate(10.f, 0.f); 87 localM.postTranslate(10.f, 0.f);
88 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kMirror_TileMode, 88 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kMirror_TileMode,
89 SkShader::kMirror_TileMode, 89 SkShader::kMirror_TileMode,
90 &localM)); 90 &localM));
91 paint.setFilterQuality(kMedium_SkFilterQuality); 91 paint.setFilterQuality(kMedium_SkFilterQuality);
92 canvas->drawPaint(paint); 92 canvas->drawPaint(paint);
93 return; 93 return;
94 } 94 }
95 95
96 // need to explicitly declare this, or we get some weird infinite loop llist 96 // need to explicitly declare this, or we get some weird infinite loop llist
97 template GMRegistry* GMRegistry::gHead; 97 template GMRegistry* GMRegistry::gHead;
98 98
99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { 99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) {
100 fDrawProc(canvas); 100 fDrawProc(canvas);
101 } 101 }
102 102
103 SkISize skiagm::SimpleGM::onISize() { 103 SkISize skiagm::SimpleGM::onISize() {
104 return fSize; 104 return fSize;
105 } 105 }
106 106
107 SkString skiagm::SimpleGM::onShortName() { 107 SkString skiagm::SimpleGM::onShortName() {
108 return fName; 108 return fName;
109 } 109 }
OLDNEW
« no previous file with comments | « gm/glyph_pos_align.cpp ('k') | gm/gradientDirtyLaundry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698