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

Side by Side Diff: gm/pathfill.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/patheffects.cpp ('k') | gm/pathinterior.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 9
10 typedef SkScalar (*MakePathProc)(SkPath*); 10 typedef SkScalar (*MakePathProc)(SkPath*);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 make_star_13, 111 make_star_13,
112 make_line, 112 make_line,
113 }; 113 };
114 114
115 #define N SK_ARRAY_COUNT(gProcs) 115 #define N SK_ARRAY_COUNT(gProcs)
116 116
117 class PathFillGM : public skiagm::GM { 117 class PathFillGM : public skiagm::GM {
118 SkPath fPath[N]; 118 SkPath fPath[N];
119 SkScalar fDY[N]; 119 SkScalar fDY[N];
120 protected: 120 protected:
121 void onOnceBeforeDraw() SK_OVERRIDE { 121 void onOnceBeforeDraw() override {
122 for (size_t i = 0; i < N; i++) { 122 for (size_t i = 0; i < N; i++) {
123 fDY[i] = gProcs[i](&fPath[i]); 123 fDY[i] = gProcs[i](&fPath[i]);
124 } 124 }
125 } 125 }
126 126
127 127
128 SkString onShortName() SK_OVERRIDE { 128 SkString onShortName() override {
129 return SkString("pathfill"); 129 return SkString("pathfill");
130 } 130 }
131 131
132 SkISize onISize() SK_OVERRIDE { 132 SkISize onISize() override {
133 return SkISize::Make(640, 480); 133 return SkISize::Make(640, 480);
134 } 134 }
135 135
136 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 136 void onDraw(SkCanvas* canvas) override {
137 SkPaint paint; 137 SkPaint paint;
138 paint.setAntiAlias(true); 138 paint.setAntiAlias(true);
139 139
140 for (size_t i = 0; i < N; i++) { 140 for (size_t i = 0; i < N; i++) {
141 canvas->drawPath(fPath[i], paint); 141 canvas->drawPath(fPath[i], paint);
142 canvas->translate(SkIntToScalar(0), fDY[i]); 142 canvas->translate(SkIntToScalar(0), fDY[i]);
143 } 143 }
144 } 144 }
145 145
146 private: 146 private:
147 typedef skiagm::GM INHERITED; 147 typedef skiagm::GM INHERITED;
148 }; 148 };
149 149
150 // test inverse-fill w/ a clip that completely excludes the geometry 150 // test inverse-fill w/ a clip that completely excludes the geometry
151 class PathInverseFillGM : public skiagm::GM { 151 class PathInverseFillGM : public skiagm::GM {
152 SkPath fPath[N]; 152 SkPath fPath[N];
153 SkScalar fDY[N]; 153 SkScalar fDY[N];
154 protected: 154 protected:
155 void onOnceBeforeDraw() SK_OVERRIDE { 155 void onOnceBeforeDraw() override {
156 for (size_t i = 0; i < N; i++) { 156 for (size_t i = 0; i < N; i++) {
157 fDY[i] = gProcs[i](&fPath[i]); 157 fDY[i] = gProcs[i](&fPath[i]);
158 } 158 }
159 } 159 }
160 160
161 SkString onShortName() SK_OVERRIDE { 161 SkString onShortName() override {
162 return SkString("pathinvfill"); 162 return SkString("pathinvfill");
163 } 163 }
164 164
165 SkISize onISize() SK_OVERRIDE { 165 SkISize onISize() override {
166 return SkISize::Make(450, 220); 166 return SkISize::Make(450, 220);
167 } 167 }
168 168
169 static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint, 169 static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint,
170 const SkRect* clip, SkScalar top, const SkScalar bottom) { 170 const SkRect* clip, SkScalar top, const SkScalar bottom) {
171 canvas->save(); 171 canvas->save();
172 if (clip) { 172 if (clip) {
173 SkRect r = *clip; 173 SkRect r = *clip;
174 r.fTop = top; 174 r.fTop = top;
175 r.fBottom = bottom; 175 r.fBottom = bottom;
176 canvas->clipRect(r); 176 canvas->clipRect(r);
177 } 177 }
178 canvas->drawPath(path, paint); 178 canvas->drawPath(path, paint);
179 canvas->restore(); 179 canvas->restore();
180 } 180 }
181 181
182 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 182 void onDraw(SkCanvas* canvas) override {
183 SkPath path; 183 SkPath path;
184 184
185 path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40)); 185 path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40));
186 path.toggleInverseFillType(); 186 path.toggleInverseFillType();
187 187
188 SkRect clipR = { 0, 0, SkIntToScalar(100), SkIntToScalar(200) }; 188 SkRect clipR = { 0, 0, SkIntToScalar(100), SkIntToScalar(200) };
189 189
190 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 190 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
191 191
192 for (int doclip = 0; doclip <= 1; ++doclip) { 192 for (int doclip = 0; doclip <= 1; ++doclip) {
(...skipping 19 matching lines...) Expand all
212 typedef skiagm::GM INHERITED; 212 typedef skiagm::GM INHERITED;
213 }; 213 };
214 214
215 /////////////////////////////////////////////////////////////////////////////// 215 ///////////////////////////////////////////////////////////////////////////////
216 216
217 static skiagm::GM* MyFactory(void*) { return new PathFillGM; } 217 static skiagm::GM* MyFactory(void*) { return new PathFillGM; }
218 static skiagm::GMRegistry reg(MyFactory); 218 static skiagm::GMRegistry reg(MyFactory);
219 219
220 static skiagm::GM* F1(void*) { return new PathInverseFillGM; } 220 static skiagm::GM* F1(void*) { return new PathInverseFillGM; }
221 static skiagm::GMRegistry gR1(F1); 221 static skiagm::GMRegistry gR1(F1);
OLDNEW
« no previous file with comments | « gm/patheffects.cpp ('k') | gm/pathinterior.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698