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

Side by Side Diff: gm/pathfill.cpp

Issue 815883002: Cleanup: Another round of override fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert include changes Created 6 years 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 protected: 127 protected:
128 virtual uint32_t onGetFlags() const SK_OVERRIDE { 128 virtual uint32_t onGetFlags() const SK_OVERRIDE {
129 return kSkipTiled_Flag; 129 return kSkipTiled_Flag;
130 } 130 }
131 131
132 virtual SkString onShortName() { 132 virtual SkString onShortName() SK_OVERRIDE {
133 return SkString("pathfill"); 133 return SkString("pathfill");
134 } 134 }
135 135
136 virtual SkISize onISize() { 136 virtual SkISize onISize() SK_OVERRIDE {
137 return SkISize::Make(640, 480); 137 return SkISize::Make(640, 480);
138 } 138 }
139 139
140 virtual void onDraw(SkCanvas* canvas) { 140 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
141 SkPaint paint; 141 SkPaint paint;
142 paint.setAntiAlias(true); 142 paint.setAntiAlias(true);
143 143
144 for (size_t i = 0; i < N; i++) { 144 for (size_t i = 0; i < N; i++) {
145 canvas->drawPath(fPath[i], paint); 145 canvas->drawPath(fPath[i], paint);
146 canvas->translate(SkIntToScalar(0), fDY[i]); 146 canvas->translate(SkIntToScalar(0), fDY[i]);
147 } 147 }
148 } 148 }
149 149
150 private: 150 private:
151 typedef skiagm::GM INHERITED; 151 typedef skiagm::GM INHERITED;
152 }; 152 };
153 153
154 // test inverse-fill w/ a clip that completely excludes the geometry 154 // test inverse-fill w/ a clip that completely excludes the geometry
155 class PathInverseFillGM : public skiagm::GM { 155 class PathInverseFillGM : public skiagm::GM {
156 SkPath fPath[N]; 156 SkPath fPath[N];
157 SkScalar fDY[N]; 157 SkScalar fDY[N];
158 public: 158 public:
159 PathInverseFillGM() { 159 PathInverseFillGM() {
160 for (size_t i = 0; i < N; i++) { 160 for (size_t i = 0; i < N; i++) {
161 fDY[i] = gProcs[i](&fPath[i]); 161 fDY[i] = gProcs[i](&fPath[i]);
162 } 162 }
163 } 163 }
164 164
165 protected: 165 protected:
166 virtual uint32_t onGetFlags() const SK_OVERRIDE { 166 virtual uint32_t onGetFlags() const SK_OVERRIDE {
167 return kSkipTiled_Flag; 167 return kSkipTiled_Flag;
168 } 168 }
169 169
170 virtual SkString onShortName() { 170 virtual SkString onShortName() SK_OVERRIDE {
171 return SkString("pathinvfill"); 171 return SkString("pathinvfill");
172 } 172 }
173 173
174 virtual SkISize onISize() { 174 virtual SkISize onISize() SK_OVERRIDE {
175 return SkISize::Make(450, 220); 175 return SkISize::Make(450, 220);
176 } 176 }
177 177
178 static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint, 178 static void show(SkCanvas* canvas, const SkPath& path, const SkPaint& paint,
179 const SkRect* clip, SkScalar top, const SkScalar bottom) { 179 const SkRect* clip, SkScalar top, const SkScalar bottom) {
180 canvas->save(); 180 canvas->save();
181 if (clip) { 181 if (clip) {
182 SkRect r = *clip; 182 SkRect r = *clip;
183 r.fTop = top; 183 r.fTop = top;
184 r.fBottom = bottom; 184 r.fBottom = bottom;
185 canvas->clipRect(r); 185 canvas->clipRect(r);
186 } 186 }
187 canvas->drawPath(path, paint); 187 canvas->drawPath(path, paint);
188 canvas->restore(); 188 canvas->restore();
189 } 189 }
190 190
191 virtual void onDraw(SkCanvas* canvas) { 191 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
192 SkPath path; 192 SkPath path;
193 193
194 path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40)); 194 path.addCircle(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(40));
195 path.toggleInverseFillType(); 195 path.toggleInverseFillType();
196 196
197 SkRect clipR = { 0, 0, SkIntToScalar(100), SkIntToScalar(200) }; 197 SkRect clipR = { 0, 0, SkIntToScalar(100), SkIntToScalar(200) };
198 198
199 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); 199 canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
200 200
201 for (int doclip = 0; doclip <= 1; ++doclip) { 201 for (int doclip = 0; doclip <= 1; ++doclip) {
(...skipping 19 matching lines...) Expand all
221 typedef skiagm::GM INHERITED; 221 typedef skiagm::GM INHERITED;
222 }; 222 };
223 223
224 /////////////////////////////////////////////////////////////////////////////// 224 ///////////////////////////////////////////////////////////////////////////////
225 225
226 static skiagm::GM* MyFactory(void*) { return new PathFillGM; } 226 static skiagm::GM* MyFactory(void*) { return new PathFillGM; }
227 static skiagm::GMRegistry reg(MyFactory); 227 static skiagm::GMRegistry reg(MyFactory);
228 228
229 static skiagm::GM* F1(void*) { return new PathInverseFillGM; } 229 static skiagm::GM* F1(void*) { return new PathInverseFillGM; }
230 static skiagm::GMRegistry gR1(F1); 230 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