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

Side by Side Diff: samplecode/SampleBitmapRect.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/SampleArc.cpp ('k') | samplecode/SampleCamera.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 2011 Google Inc. 2 * Copyright 2011 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 fDstR[0] = SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScalar(100), 96 fDstR[0] = SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScalar(100),
97 SkIntToScalar(250), SkIntToScalar(300)); 97 SkIntToScalar(250), SkIntToScalar(300));
98 fDstR[1] = fDstR[0]; 98 fDstR[1] = fDstR[0];
99 fDstR[1].offset(fDstR[0].width() * 5/4, 0); 99 fDstR[1].offset(fDstR[0].width() * 5/4, 0);
100 100
101 fSrcPts[0].set(32, 32); 101 fSrcPts[0].set(32, 32);
102 fSrcPts[1].set(90, 90); 102 fSrcPts[1].set(90, 90);
103 } 103 }
104 104
105 protected: 105 protected:
106 bool onQuery(SkEvent* evt) SK_OVERRIDE { 106 bool onQuery(SkEvent* evt) override {
107 if (SampleCode::TitleQ(*evt)) { 107 if (SampleCode::TitleQ(*evt)) {
108 SampleCode::TitleR(evt, "BitmapRect"); 108 SampleCode::TitleR(evt, "BitmapRect");
109 return true; 109 return true;
110 } 110 }
111 return this->INHERITED::onQuery(evt); 111 return this->INHERITED::onQuery(evt);
112 } 112 }
113 113
114 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 114 void onDrawContent(SkCanvas* canvas) override {
115 SkRect srcR; 115 SkRect srcR;
116 srcR.set(fSrcPts[0], fSrcPts[1]); 116 srcR.set(fSrcPts[0], fSrcPts[1]);
117 srcR = SkRect::MakeXYWH(fSrcPts[0].fX, fSrcPts[0].fY, 32, 32); 117 srcR = SkRect::MakeXYWH(fSrcPts[0].fX, fSrcPts[0].fY, 32, 32);
118 srcR.offset(-srcR.width()/2, -srcR.height()/2); 118 srcR.offset(-srcR.width()/2, -srcR.height()/2);
119 119
120 SkPaint paint; 120 SkPaint paint;
121 paint.setStyle(SkPaint::kStroke_Style); 121 paint.setStyle(SkPaint::kStroke_Style);
122 paint.setColor(SK_ColorYELLOW); 122 paint.setColor(SK_ColorYELLOW);
123 123
124 SkBitmap bitmap; 124 SkBitmap bitmap;
125 make_bitmap(&bitmap); 125 make_bitmap(&bitmap);
126 126
127 canvas->translate(20, 20); 127 canvas->translate(20, 20);
128 128
129 canvas->drawBitmap(bitmap, 0, 0, &paint); 129 canvas->drawBitmap(bitmap, 0, 0, &paint);
130 canvas->drawRect(srcR, paint); 130 canvas->drawRect(srcR, paint);
131 131
132 for (int i = 0; i < 2; ++i) { 132 for (int i = 0; i < 2; ++i) {
133 paint.setFilterQuality(1 == i ? kLow_SkFilterQuality : kNone_SkFilte rQuality); 133 paint.setFilterQuality(1 == i ? kLow_SkFilterQuality : kNone_SkFilte rQuality);
134 canvas->drawBitmapRectToRect(bitmap, &srcR, fDstR[i], &paint); 134 canvas->drawBitmapRectToRect(bitmap, &srcR, fDstR[i], &paint);
135 canvas->drawRect(fDstR[i], paint); 135 canvas->drawRect(fDstR[i], paint);
136 } 136 }
137 } 137 }
138 138
139 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { 139 bool onAnimate(const SkAnimTimer& timer) override {
140 if (timer.isStopped()) { 140 if (timer.isStopped()) {
141 this->resetBounce(); 141 this->resetBounce();
142 } else if (timer.isRunning()) { 142 } else if (timer.isRunning()) {
143 this->bounce(); 143 this->bounce();
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 private: 148 private:
149 typedef SampleView INHERITED; 149 typedef SampleView INHERITED;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 this->resetBounce(); 203 this->resetBounce();
204 204
205 fLimitR.iset(0, 0, fBitmap.width(), fBitmap.height()); 205 fLimitR.iset(0, 0, fBitmap.width(), fBitmap.height());
206 206
207 fDstR[0] = SkRect::MakeXYWH(20, 20, 600, 200); 207 fDstR[0] = SkRect::MakeXYWH(20, 20, 600, 200);
208 fDstR[1] = fDstR[0]; 208 fDstR[1] = fDstR[0];
209 fDstR[1].offset(0, fDstR[0].height() * 5/4); 209 fDstR[1].offset(0, fDstR[0].height() * 5/4);
210 } 210 }
211 211
212 protected: 212 protected:
213 bool onQuery(SkEvent* evt) SK_OVERRIDE { 213 bool onQuery(SkEvent* evt) override {
214 if (SampleCode::TitleQ(*evt)) { 214 if (SampleCode::TitleQ(*evt)) {
215 SampleCode::TitleR(evt, "BigBitmapRect"); 215 SampleCode::TitleR(evt, "BigBitmapRect");
216 return true; 216 return true;
217 } 217 }
218 return this->INHERITED::onQuery(evt); 218 return this->INHERITED::onQuery(evt);
219 } 219 }
220 220
221 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 221 void onDrawContent(SkCanvas* canvas) override {
222 SkPaint paint; 222 SkPaint paint;
223 paint.setStyle(SkPaint::kStroke_Style); 223 paint.setStyle(SkPaint::kStroke_Style);
224 paint.setColor(SK_ColorYELLOW); 224 paint.setColor(SK_ColorYELLOW);
225 225
226 for (int i = 0; i < 2; ++i) { 226 for (int i = 0; i < 2; ++i) {
227 paint.setFilterQuality(1 == i ? kLow_SkFilterQuality : kNone_SkFilte rQuality); 227 paint.setFilterQuality(1 == i ? kLow_SkFilterQuality : kNone_SkFilte rQuality);
228 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR[i], &paint); 228 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR[i], &paint);
229 canvas->drawRect(fDstR[i], paint); 229 canvas->drawRect(fDstR[i], paint);
230 } 230 }
231 } 231 }
232 232
233 bool onAnimate(const SkAnimTimer& timer) SK_OVERRIDE { 233 bool onAnimate(const SkAnimTimer& timer) override {
234 if (timer.isStopped()) { 234 if (timer.isStopped()) {
235 this->resetBounce(); 235 this->resetBounce();
236 } else if (timer.isRunning()) { 236 } else if (timer.isRunning()) {
237 this->bounceMe(); 237 this->bounceMe();
238 } 238 }
239 return true; 239 return true;
240 } 240 }
241 241
242 private: 242 private:
243 typedef SampleView INHERITED; 243 typedef SampleView INHERITED;
244 }; 244 };
245 245
246 ////////////////////////////////////////////////////////////////////////////// 246 //////////////////////////////////////////////////////////////////////////////
247 247
248 static SkView* F0() { return new BitmapRectView; } 248 static SkView* F0() { return new BitmapRectView; }
249 static SkView* F1() { return new BitmapRectView2; } 249 static SkView* F1() { return new BitmapRectView2; }
250 static SkViewRegister gR0(F0); 250 static SkViewRegister gR0(F0);
251 static SkViewRegister gR1(F1); 251 static SkViewRegister gR1(F1);
OLDNEW
« no previous file with comments | « samplecode/SampleArc.cpp ('k') | samplecode/SampleCamera.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698