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

Side by Side Diff: gm/gradients_no_texture.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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.cpp ('k') | gm/gradtext.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 2013 Google Inc. 2 * Copyright 2013 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkGradientShader.h" 8 #include "SkGradientShader.h"
9 9
10 using namespace skiagm; 10 using namespace skiagm;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 /////////////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////////////
80 80
81 class GradientsNoTextureGM : public GM { 81 class GradientsNoTextureGM : public GM {
82 public: 82 public:
83 GradientsNoTextureGM() { 83 GradientsNoTextureGM() {
84 this->setBGColor(0xFFDDDDDD); 84 this->setBGColor(0xFFDDDDDD);
85 } 85 }
86 86
87 protected: 87 protected:
88 virtual uint32_t onGetFlags() const SK_OVERRIDE { 88 uint32_t onGetFlags() const SK_OVERRIDE {
89 return kSkipTiled_Flag; 89 return kSkipTiled_Flag;
90 } 90 }
91 91
92 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture") ; } 92 SkString onShortName() SK_OVERRIDE { return SkString("gradients_no_texture") ; }
93 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 615); } 93 SkISize onISize() SK_OVERRIDE { return SkISize::Make(640, 615); }
94 94
95 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 95 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
96 static const SkPoint kPts[2] = { { 0, 0 }, 96 static const SkPoint kPts[2] = { { 0, 0 },
97 { SkIntToScalar(50), SkIntToScalar(50) } }; 97 { SkIntToScalar(50), SkIntToScalar(50) } };
98 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode; 98 static const SkShader::TileMode kTM = SkShader::kClamp_TileMode;
99 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) }; 99 SkRect kRect = { 0, 0, SkIntToScalar(50), SkIntToScalar(50) };
100 SkPaint paint; 100 SkPaint paint;
101 paint.setAntiAlias(true); 101 paint.setAntiAlias(true);
102 102
103 canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); 103 canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
104 static const uint8_t kAlphas[] = { 0xff, 0x40 }; 104 static const uint8_t kAlphas[] = { 0xff, 0x40 };
105 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) { 105 for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphas); ++a) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 enum { 204 enum {
205 W = 800, 205 W = 800,
206 }; 206 };
207 SkAutoTUnref<SkShader> fShader; 207 SkAutoTUnref<SkShader> fShader;
208 208
209 typedef void (*Proc)(ColorPos*); 209 typedef void (*Proc)(ColorPos*);
210 public: 210 public:
211 GradientsManyColorsGM() {} 211 GradientsManyColorsGM() {}
212 212
213 protected: 213 protected:
214 virtual uint32_t onGetFlags() const SK_OVERRIDE { 214 uint32_t onGetFlags() const SK_OVERRIDE {
215 return kSkipTiled_Flag; 215 return kSkipTiled_Flag;
216 } 216 }
217 217
218 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); } 218 SkString onShortName() SK_OVERRIDE { return SkString("gradients_many"); }
219 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); } 219 SkISize onISize() SK_OVERRIDE { return SkISize::Make(850, 100); }
220 220
221 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 221 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
222 const Proc procs[] = { 222 const Proc procs[] = {
223 make0, make1, make2, 223 make0, make1, make2,
224 }; 224 };
225 const SkPoint pts[] = { 225 const SkPoint pts[] = {
226 { 0, 0 }, 226 { 0, 0 },
227 { SkIntToScalar(W), 0 }, 227 { SkIntToScalar(W), 0 },
228 }; 228 };
229 const SkRect r = SkRect::MakeWH(SkIntToScalar(W), 30); 229 const SkRect r = SkRect::MakeWH(SkIntToScalar(W), 30);
230 230
231 SkPaint paint; 231 SkPaint paint;
(...skipping 17 matching lines...) Expand all
249 } 249 }
250 250
251 private: 251 private:
252 typedef GM INHERITED; 252 typedef GM INHERITED;
253 }; 253 };
254 254
255 /////////////////////////////////////////////////////////////////////////////// 255 ///////////////////////////////////////////////////////////////////////////////
256 256
257 DEF_GM( return SkNEW(GradientsNoTextureGM)); 257 DEF_GM( return SkNEW(GradientsNoTextureGM));
258 DEF_GM( return SkNEW(GradientsManyColorsGM)); 258 DEF_GM( return SkNEW(GradientsManyColorsGM));
OLDNEW
« no previous file with comments | « gm/gradients.cpp ('k') | gm/gradtext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698