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

Side by Side Diff: gm/composeshader.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/complexclip2.cpp ('k') | gm/convexpaths.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 2012 Google Inc. 2 * Copyright 2012 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 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public: 42 public:
43 ComposeShaderGM() { 43 ComposeShaderGM() {
44 fShader = make_shader(SkXfermode::kDstIn_Mode); 44 fShader = make_shader(SkXfermode::kDstIn_Mode);
45 } 45 }
46 46
47 virtual ~ComposeShaderGM() { 47 virtual ~ComposeShaderGM() {
48 SkSafeUnref(fShader); 48 SkSafeUnref(fShader);
49 } 49 }
50 50
51 protected: 51 protected:
52 virtual SkString onShortName() SK_OVERRIDE { 52 SkString onShortName() SK_OVERRIDE {
53 return SkString("composeshader"); 53 return SkString("composeshader");
54 } 54 }
55 55
56 virtual SkISize onISize() SK_OVERRIDE { 56 SkISize onISize() SK_OVERRIDE {
57 return SkISize::Make(120, 120); 57 return SkISize::Make(120, 120);
58 } 58 }
59 59
60 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 60 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
61 61
62 SkPaint paint; 62 SkPaint paint;
63 63
64 paint.setColor(SK_ColorGREEN); 64 paint.setColor(SK_ColorGREEN);
65 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai nt); 65 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai nt);
66 paint.setShader(fShader); 66 paint.setShader(fShader);
67 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai nt); 67 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai nt);
68 } 68 }
69 69
70 protected: 70 protected:
71 SkShader* fShader; 71 SkShader* fShader;
72 72
73 private: 73 private:
74 typedef GM INHERITED ; 74 typedef GM INHERITED ;
75 }; 75 };
76 76
77 class ComposeShaderAlphaGM : public skiagm::GM { 77 class ComposeShaderAlphaGM : public skiagm::GM {
78 public: 78 public:
79 ComposeShaderAlphaGM() {} 79 ComposeShaderAlphaGM() {}
80 80
81 protected: 81 protected:
82 virtual SkString onShortName() SK_OVERRIDE { 82 SkString onShortName() SK_OVERRIDE {
83 return SkString("composeshader_alpha"); 83 return SkString("composeshader_alpha");
84 } 84 }
85 85
86 virtual SkISize onISize() SK_OVERRIDE { 86 SkISize onISize() SK_OVERRIDE {
87 return SkISize::Make(220, 750); 87 return SkISize::Make(220, 750);
88 } 88 }
89 89
90 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 90 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
91 SkAutoTUnref<SkShader> shader0(make_shader(SkXfermode::kDstIn_Mode)); 91 SkAutoTUnref<SkShader> shader0(make_shader(SkXfermode::kDstIn_Mode));
92 SkAutoTUnref<SkShader> shader1(make_shader(SkXfermode::kSrcOver_Mode)); 92 SkAutoTUnref<SkShader> shader1(make_shader(SkXfermode::kSrcOver_Mode));
93 SkShader* shaders[] = { shader0.get(), shader1.get() }; 93 SkShader* shaders[] = { shader0.get(), shader1.get() };
94 94
95 SkPaint paint; 95 SkPaint paint;
96 paint.setColor(SK_ColorGREEN); 96 paint.setColor(SK_ColorGREEN);
97 97
98 const SkRect r = SkRect::MakeXYWH(5, 5, 100, 100); 98 const SkRect r = SkRect::MakeXYWH(5, 5, 100, 100);
99 99
100 for (size_t y = 0; y < SK_ARRAY_COUNT(shaders); ++y) { 100 for (size_t y = 0; y < SK_ARRAY_COUNT(shaders); ++y) {
(...skipping 13 matching lines...) Expand all
114 canvas->restore(); 114 canvas->restore();
115 canvas->translate(0, r.height() + 5); 115 canvas->translate(0, r.height() + 5);
116 } 116 }
117 } 117 }
118 }; 118 };
119 119
120 ////////////////////////////////////////////////////////////////////////////// 120 //////////////////////////////////////////////////////////////////////////////
121 121
122 DEF_GM( return new ComposeShaderGM; ) 122 DEF_GM( return new ComposeShaderGM; )
123 DEF_GM( return new ComposeShaderAlphaGM; ) 123 DEF_GM( return new ComposeShaderAlphaGM; )
OLDNEW
« no previous file with comments | « gm/complexclip2.cpp ('k') | gm/convexpaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698