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

Side by Side Diff: gm/bitmaprect.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 | « gm/bitmappremul.cpp ('k') | gm/bitmaprecttest.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 /* 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 17 matching lines...) Expand all
28 canvas.drawCircle(32, 32, 32, paint); 28 canvas.drawCircle(32, 32, 32, paint);
29 } 29 }
30 30
31 class DrawBitmapRect2 : public skiagm::GM { 31 class DrawBitmapRect2 : public skiagm::GM {
32 bool fUseIRect; 32 bool fUseIRect;
33 public: 33 public:
34 DrawBitmapRect2(bool useIRect) : fUseIRect(useIRect) { 34 DrawBitmapRect2(bool useIRect) : fUseIRect(useIRect) {
35 } 35 }
36 36
37 protected: 37 protected:
38 SkString onShortName() SK_OVERRIDE { 38 SkString onShortName() override {
39 SkString str; 39 SkString str;
40 str.printf("bitmaprect_%s", fUseIRect ? "i" : "s"); 40 str.printf("bitmaprect_%s", fUseIRect ? "i" : "s");
41 return str; 41 return str;
42 } 42 }
43 43
44 SkISize onISize() SK_OVERRIDE { 44 SkISize onISize() override {
45 return SkISize::Make(640, 480); 45 return SkISize::Make(640, 480);
46 } 46 }
47 47
48 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 48 void onDraw(SkCanvas* canvas) override {
49 canvas->drawColor(0xFFCCCCCC); 49 canvas->drawColor(0xFFCCCCCC);
50 50
51 const SkIRect src[] = { 51 const SkIRect src[] = {
52 { 0, 0, 32, 32 }, 52 { 0, 0, 32, 32 },
53 { 0, 0, 80, 80 }, 53 { 0, 0, 80, 80 },
54 { 32, 32, 96, 96 }, 54 { 32, 32, 96, 96 },
55 { -32, -32, 32, 32, } 55 { -32, -32, 32, 32, }
56 }; 56 };
57 57
58 SkPaint paint; 58 SkPaint paint;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // | | 117 // | |
118 // __|____|__ 118 // __|____|__
119 // | | 119 // | |
120 class DrawBitmapRect3 : public skiagm::GM { 120 class DrawBitmapRect3 : public skiagm::GM {
121 public: 121 public:
122 DrawBitmapRect3() { 122 DrawBitmapRect3() {
123 this->setBGColor(SK_ColorBLACK); 123 this->setBGColor(SK_ColorBLACK);
124 } 124 }
125 125
126 protected: 126 protected:
127 SkString onShortName() SK_OVERRIDE { 127 SkString onShortName() override {
128 SkString str; 128 SkString str;
129 str.printf("3x3bitmaprect"); 129 str.printf("3x3bitmaprect");
130 return str; 130 return str;
131 } 131 }
132 132
133 SkISize onISize() SK_OVERRIDE { 133 SkISize onISize() override {
134 return SkISize::Make(640, 480); 134 return SkISize::Make(640, 480);
135 } 135 }
136 136
137 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 137 void onDraw(SkCanvas* canvas) override {
138 138
139 SkBitmap bitmap; 139 SkBitmap bitmap;
140 make_3x3_bitmap(&bitmap); 140 make_3x3_bitmap(&bitmap);
141 141
142 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f }; 142 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f };
143 SkRect dstR = { 100, 100, 300, 200 }; 143 SkRect dstR = { 100, 100, 300, 200 };
144 144
145 canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL); 145 canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL);
146 } 146 }
147 147
(...skipping 28 matching lines...) Expand all
176 class DrawBitmapRect4 : public skiagm::GM { 176 class DrawBitmapRect4 : public skiagm::GM {
177 bool fUseIRect; 177 bool fUseIRect;
178 SkBitmap fBigBitmap; 178 SkBitmap fBigBitmap;
179 179
180 public: 180 public:
181 DrawBitmapRect4(bool useIRect) : fUseIRect(useIRect) { 181 DrawBitmapRect4(bool useIRect) : fUseIRect(useIRect) {
182 this->setBGColor(0x88444444); 182 this->setBGColor(0x88444444);
183 } 183 }
184 184
185 protected: 185 protected:
186 SkString onShortName() SK_OVERRIDE { 186 SkString onShortName() override {
187 SkString str; 187 SkString str;
188 str.printf("bigbitmaprect_%s", fUseIRect ? "i" : "s"); 188 str.printf("bigbitmaprect_%s", fUseIRect ? "i" : "s");
189 return str; 189 return str;
190 } 190 }
191 191
192 SkISize onISize() SK_OVERRIDE { 192 SkISize onISize() override {
193 return SkISize::Make(640, 480); 193 return SkISize::Make(640, 480);
194 } 194 }
195 195
196 void onOnceBeforeDraw() SK_OVERRIDE { 196 void onOnceBeforeDraw() override {
197 make_big_bitmap(&fBigBitmap); 197 make_big_bitmap(&fBigBitmap);
198 } 198 }
199 199
200 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 200 void onDraw(SkCanvas* canvas) override {
201 201
202 SkXfermode* mode = SkXfermode::Create(SkXfermode::kXor_Mode); 202 SkXfermode* mode = SkXfermode::Create(SkXfermode::kXor_Mode);
203 203
204 SkPaint paint; 204 SkPaint paint;
205 paint.setAlpha(128); 205 paint.setAlpha(128);
206 paint.setXfermode(mode)->unref(); 206 paint.setXfermode(mode)->unref();
207 207
208 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f }; 208 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f };
209 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f }; 209 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f };
210 210
(...skipping 18 matching lines...) Expand all
229 typedef skiagm::GM INHERITED; 229 typedef skiagm::GM INHERITED;
230 }; 230 };
231 231
232 class BitmapRectRounding : public skiagm::GM { 232 class BitmapRectRounding : public skiagm::GM {
233 SkBitmap fBM; 233 SkBitmap fBM;
234 234
235 public: 235 public:
236 BitmapRectRounding() {} 236 BitmapRectRounding() {}
237 237
238 protected: 238 protected:
239 SkString onShortName() SK_OVERRIDE { 239 SkString onShortName() override {
240 SkString str; 240 SkString str;
241 str.printf("bitmaprect_rounding"); 241 str.printf("bitmaprect_rounding");
242 return str; 242 return str;
243 } 243 }
244 244
245 SkISize onISize() SK_OVERRIDE { 245 SkISize onISize() override {
246 return SkISize::Make(640, 480); 246 return SkISize::Make(640, 480);
247 } 247 }
248 248
249 void onOnceBeforeDraw() SK_OVERRIDE { 249 void onOnceBeforeDraw() override {
250 fBM.allocN32Pixels(10, 10); 250 fBM.allocN32Pixels(10, 10);
251 fBM.eraseColor(SK_ColorBLUE); 251 fBM.eraseColor(SK_ColorBLUE);
252 } 252 }
253 253
254 // This choice of coordinates and matrix land the bottom edge of the clip (a nd bitmap dst) 254 // This choice of coordinates and matrix land the bottom edge of the clip (a nd bitmap dst)
255 // at exactly 1/2 pixel boundary. However, drawBitmapRect may lose precision along the way. 255 // at exactly 1/2 pixel boundary. However, drawBitmapRect may lose precision along the way.
256 // If it does, we may see a red-line at the bottom, instead of the bitmap ex actly matching 256 // If it does, we may see a red-line at the bottom, instead of the bitmap ex actly matching
257 // the clip (in which case we should see all blue). 257 // the clip (in which case we should see all blue).
258 // The correct image should be all blue. 258 // The correct image should be all blue.
259 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 259 void onDraw(SkCanvas* canvas) override {
260 SkPaint paint; 260 SkPaint paint;
261 paint.setColor(SK_ColorRED); 261 paint.setColor(SK_ColorRED);
262 262
263 const SkRect r = SkRect::MakeXYWH(1, 1, 110, 114); 263 const SkRect r = SkRect::MakeXYWH(1, 1, 110, 114);
264 canvas->scale(0.9f, 0.9f); 264 canvas->scale(0.9f, 0.9f);
265 265
266 // the drawRect shows the same problem as clipRect(r) followed by drawco lor(red) 266 // the drawRect shows the same problem as clipRect(r) followed by drawco lor(red)
267 canvas->drawRect(r, paint); 267 canvas->drawRect(r, paint);
268 canvas->drawBitmapRect(fBM, NULL, r, NULL); 268 canvas->drawBitmapRect(fBM, NULL, r, NULL);
269 } 269 }
(...skipping 18 matching lines...) Expand all
288 static skiagm::GMRegistry reg0(MyFactory0); 288 static skiagm::GMRegistry reg0(MyFactory0);
289 static skiagm::GMRegistry reg1(MyFactory1); 289 static skiagm::GMRegistry reg1(MyFactory1);
290 290
291 static skiagm::GMRegistry reg2(MyFactory2); 291 static skiagm::GMRegistry reg2(MyFactory2);
292 292
293 #ifndef SK_BUILD_FOR_ANDROID 293 #ifndef SK_BUILD_FOR_ANDROID
294 static skiagm::GMRegistry reg3(MyFactory3); 294 static skiagm::GMRegistry reg3(MyFactory3);
295 static skiagm::GMRegistry reg4(MyFactory4); 295 static skiagm::GMRegistry reg4(MyFactory4);
296 #endif 296 #endif
297 297
OLDNEW
« no previous file with comments | « gm/bitmappremul.cpp ('k') | gm/bitmaprecttest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698