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

Side by Side Diff: gm/gradtext.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/gradients_no_texture.cpp ('k') | gm/hairlines.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 typedef GM INHERITED; 95 typedef GM INHERITED;
96 }; 96 };
97 97
98 98
99 99
100 class GradTextGM : public GM { 100 class GradTextGM : public GM {
101 public: 101 public:
102 GradTextGM () {} 102 GradTextGM () {}
103 103
104 protected: 104 protected:
105 SkString onShortName() SK_OVERRIDE { 105 SkString onShortName() override {
106 return SkString("gradtext"); 106 return SkString("gradtext");
107 } 107 }
108 108
109 SkISize onISize() SK_OVERRIDE { return SkISize::Make(500, 480); } 109 SkISize onISize() override { return SkISize::Make(500, 480); }
110 110
111 static void draw_text(SkCanvas* canvas, const SkPaint& paint) { 111 static void draw_text(SkCanvas* canvas, const SkPaint& paint) {
112 const char* text = "When in the course of human events"; 112 const char* text = "When in the course of human events";
113 size_t len = strlen(text); 113 size_t len = strlen(text);
114 canvas->drawText(text, len, 0, 0, paint); 114 canvas->drawText(text, len, 0, 0, paint);
115 } 115 }
116 116
117 static void draw_text3(SkCanvas* canvas, const SkPaint& paint) { 117 static void draw_text3(SkCanvas* canvas, const SkPaint& paint) {
118 SkPaint p(paint); 118 SkPaint p(paint);
119 119
120 p.setAntiAlias(false); 120 p.setAntiAlias(false);
121 draw_text(canvas, p); 121 draw_text(canvas, p);
122 p.setAntiAlias(true); 122 p.setAntiAlias(true);
123 canvas->translate(0, paint.getTextSize() * 4/3); 123 canvas->translate(0, paint.getTextSize() * 4/3);
124 draw_text(canvas, p); 124 draw_text(canvas, p);
125 p.setLCDRenderText(true); 125 p.setLCDRenderText(true);
126 canvas->translate(0, paint.getTextSize() * 4/3); 126 canvas->translate(0, paint.getTextSize() * 4/3);
127 draw_text(canvas, p); 127 draw_text(canvas, p);
128 } 128 }
129 129
130 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 130 void onDraw(SkCanvas* canvas) override {
131 SkPaint paint; 131 SkPaint paint;
132 sk_tool_utils::set_portable_typeface(&paint); 132 sk_tool_utils::set_portable_typeface(&paint);
133 paint.setTextSize(SkIntToScalar(26)); 133 paint.setTextSize(SkIntToScalar(26));
134 134
135 const SkISize& size = this->getISize(); 135 const SkISize& size = this->getISize();
136 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), 136 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
137 SkIntToScalar(size.height()) / 2); 137 SkIntToScalar(size.height()) / 2);
138 canvas->drawRect(r, paint); 138 canvas->drawRect(r, paint);
139 139
140 canvas->translate(SkIntToScalar(20), paint.getTextSize()); 140 canvas->translate(SkIntToScalar(20), paint.getTextSize());
(...skipping 18 matching lines...) Expand all
159 ////////////////////////////////////////////////////////////////////////////// 159 //////////////////////////////////////////////////////////////////////////////
160 160
161 static GM* MyFactory(void*) { return new GradTextGM; } 161 static GM* MyFactory(void*) { return new GradTextGM; }
162 static GM* CMyFactory(void*) { return new ChromeGradTextGM1; } 162 static GM* CMyFactory(void*) { return new ChromeGradTextGM1; }
163 static GM* CMyFactory2(void*) { return new ChromeGradTextGM2; } 163 static GM* CMyFactory2(void*) { return new ChromeGradTextGM2; }
164 164
165 static GMRegistry reg(MyFactory); 165 static GMRegistry reg(MyFactory);
166 static GMRegistry Creg(CMyFactory); 166 static GMRegistry Creg(CMyFactory);
167 static GMRegistry Creg2(CMyFactory2); 167 static GMRegistry Creg2(CMyFactory2);
168 } 168 }
OLDNEW
« no previous file with comments | « gm/gradients_no_texture.cpp ('k') | gm/hairlines.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698