OLD | NEW |
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 Loading... |
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 bool onQuery(SkEvent* evt) SK_OVERRIDE { | 80 bool onQuery(SkEvent* evt) 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 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 90 void onDrawContent(SkCanvas* canvas) override { |
91 SkPaint paint; | 91 SkPaint paint; |
92 paint.setDither(true); | 92 paint.setDither(true); |
93 paint.setFilterQuality(kLow_SkFilterQuality); | 93 paint.setFilterQuality(kLow_SkFilterQuality); |
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 Loading... |
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 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) SK_OVERR
IDE { | 122 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned) override
{ |
123 return new Click(this); | 123 return new Click(this); |
124 } | 124 } |
125 | 125 |
126 bool onClick(Click* click) SK_OVERRIDE { | 126 bool onClick(Click* click) 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 Loading... |
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); |
OLD | NEW |