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

Side by Side Diff: samplecode/SampleVertices.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 | « samplecode/SampleUnpremul.cpp ('k') | site/user/sample/hello.md » ('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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 this->setBGColor(SK_ColorGRAY); 70 this->setBGColor(SK_ColorGRAY);
71 } 71 }
72 72
73 virtual ~VerticesView() { 73 virtual ~VerticesView() {
74 SkSafeUnref(fShader0); 74 SkSafeUnref(fShader0);
75 SkSafeUnref(fShader1); 75 SkSafeUnref(fShader1);
76 } 76 }
77 77
78 protected: 78 protected:
79 // overrides from SkEventSink 79 // overrides from SkEventSink
80 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE { 80 bool onQuery(SkEvent* evt) SK_OVERRIDE {
81 if (SampleCode::TitleQ(*evt)) { 81 if (SampleCode::TitleQ(*evt)) {
82 SampleCode::TitleR(evt, "Vertices"); 82 SampleCode::TitleR(evt, "Vertices");
83 return true; 83 return true;
84 } 84 }
85 return this->INHERITED::onQuery(evt); 85 return this->INHERITED::onQuery(evt);
86 } 86 }
87 87
88 SkScalar fScale; 88 SkScalar fScale;
89 89
90 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 90 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
91 SkPaint paint; 91 SkPaint paint;
92 paint.setDither(true); 92 paint.setDither(true);
93 paint.setFilterLevel(SkPaint::kLow_FilterLevel); 93 paint.setFilterLevel(SkPaint::kLow_FilterLevel);
94 94
95 for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) { 95 for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
96 canvas->save(); 96 canvas->save();
97 97
98 paint.setShader(NULL); 98 paint.setShader(NULL);
99 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount, 99 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
100 fRecs[i].fVerts, fRecs[i].fTexs, 100 fRecs[i].fVerts, fRecs[i].fTexs,
(...skipping 11 matching lines...) Expand all
112 paint.setShader(fShader1); 112 paint.setShader(fShader1);
113 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount, 113 canvas->drawVertices(fRecs[i].fMode, fRecs[i].fCount,
114 fRecs[i].fVerts, fRecs[i].fTexs, 114 fRecs[i].fVerts, fRecs[i].fTexs,
115 NULL, NULL, NULL, 0, paint); 115 NULL, NULL, NULL, 0, paint);
116 canvas->restore(); 116 canvas->restore();
117 117
118 canvas->translate(0, SkIntToScalar(250)); 118 canvas->translate(0, SkIntToScalar(250));
119 } 119 }
120 } 120 }
121 121
122 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) SK_OVERRIDE { 122 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) SK_OVERR IDE {
123 return new Click(this); 123 return new Click(this);
124 } 124 }
125 125
126 virtual bool onClick(Click* click) SK_OVERRIDE { 126 bool onClick(Click* click) SK_OVERRIDE {
127 // fCurrX = click->fICurr.fX; 127 // fCurrX = click->fICurr.fX;
128 // fCurrY = click->fICurr.fY; 128 // fCurrY = click->fICurr.fY;
129 this->inval(NULL); 129 this->inval(NULL);
130 return true; 130 return true;
131 } 131 }
132 132
133 private: 133 private:
134 struct Rec { 134 struct Rec {
135 SkCanvas::VertexMode fMode; 135 SkCanvas::VertexMode fMode;
136 int fCount; 136 int fCount;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 Rec fRecs[3]; 224 Rec fRecs[3];
225 225
226 typedef SampleView INHERITED; 226 typedef SampleView INHERITED;
227 }; 227 };
228 228
229 ////////////////////////////////////////////////////////////////////////////// 229 //////////////////////////////////////////////////////////////////////////////
230 230
231 static SkView* MyFactory() { return new VerticesView; } 231 static SkView* MyFactory() { return new VerticesView; }
232 static SkViewRegister reg(MyFactory); 232 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleUnpremul.cpp ('k') | site/user/sample/hello.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698