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

Side by Side Diff: gm/shallowgradient.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/shadertext3.cpp ('k') | gm/skbug1719.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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 24 matching lines...) Expand all
35 colors, NULL, count); 35 colors, NULL, count);
36 } 36 }
37 37
38 class ShallowGradientGM : public skiagm::GM { 38 class ShallowGradientGM : public skiagm::GM {
39 public: 39 public:
40 ShallowGradientGM(MakeShaderProc proc, const char name[]) : fProc(proc) { 40 ShallowGradientGM(MakeShaderProc proc, const char name[]) : fProc(proc) {
41 fName.printf("shallow_gradient_%s", name); 41 fName.printf("shallow_gradient_%s", name);
42 } 42 }
43 43
44 protected: 44 protected:
45 virtual uint32_t onGetFlags() const SK_OVERRIDE { 45 uint32_t onGetFlags() const SK_OVERRIDE {
46 if (fName.contains("linear") || fName.contains("radial")) { 46 if (fName.contains("linear") || fName.contains("radial")) {
47 return kSkipTiled_Flag; 47 return kSkipTiled_Flag;
48 } 48 }
49 return 0; 49 return 0;
50 } 50 }
51 51
52 virtual SkString onShortName() SK_OVERRIDE { 52 SkString onShortName() SK_OVERRIDE {
53 return fName; 53 return fName;
54 } 54 }
55 55
56 virtual SkISize onISize() SK_OVERRIDE { 56 SkISize onISize() SK_OVERRIDE {
57 return SkISize::Make(800, 800); 57 return SkISize::Make(800, 800);
58 } 58 }
59 59
60 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 60 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
61 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; 61 const SkColor colors[] = { 0xFF555555, 0xFF444444 };
62 const int colorCount = SK_ARRAY_COUNT(colors); 62 const int colorCount = SK_ARRAY_COUNT(colors);
63 63
64 SkRect r = { 0, 0, this->width(), this->height() }; 64 SkRect r = { 0, 0, this->width(), this->height() };
65 SkSize size = SkSize::Make(r.width(), r.height()); 65 SkSize size = SkSize::Make(r.width(), r.height());
66 66
67 SkPaint paint; 67 SkPaint paint;
68 paint.setShader(fProc(colors, colorCount, size))->unref(); 68 paint.setShader(fProc(colors, colorCount, size))->unref();
69 canvas->drawRect(r, paint); 69 canvas->drawRect(r, paint);
70 } 70 }
71 71
72 private: 72 private:
73 MakeShaderProc fProc; 73 MakeShaderProc fProc;
74 SkString fName; 74 SkString fName;
75 75
76 typedef skiagm::GM INHERITED; 76 typedef skiagm::GM INHERITED;
77 }; 77 };
78 78
79 /////////////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////////////
80 80
81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) 81 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); )
82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) 82 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); )
83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) 83 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); )
84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) 84 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); )
OLDNEW
« no previous file with comments | « gm/shadertext3.cpp ('k') | gm/skbug1719.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698