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

Side by Side Diff: gm/blurrect.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/blurquickreject.cpp ('k') | gm/blurroundrect.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 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1]; 86 SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1];
87 SkString fName; 87 SkString fName;
88 SkAlpha fAlpha; 88 SkAlpha fAlpha;
89 public: 89 public:
90 BlurRectGM(const char name[], U8CPU alpha) 90 BlurRectGM(const char name[], U8CPU alpha)
91 : fName(name) 91 : fName(name)
92 , fAlpha(SkToU8(alpha)) { 92 , fAlpha(SkToU8(alpha)) {
93 } 93 }
94 94
95 protected: 95 protected:
96 void onOnceBeforeDraw() SK_OVERRIDE { 96 void onOnceBeforeDraw() override {
97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) { 97 for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) {
98 fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i, 98 fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i,
99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar (STROKE_WIDTH/2)), 99 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar (STROKE_WIDTH/2)),
100 SkBlurMaskFilter::kHighQuality_BlurFlag)); 100 SkBlurMaskFilter::kHighQuality_BlurFlag));
101 } 101 }
102 } 102 }
103 103
104 SkString onShortName() SK_OVERRIDE { 104 SkString onShortName() override {
105 return fName; 105 return fName;
106 } 106 }
107 107
108 SkISize onISize() SK_OVERRIDE { 108 SkISize onISize() override {
109 return SkISize::Make(860, 820); 109 return SkISize::Make(860, 820);
110 } 110 }
111 111
112 void onDraw(SkCanvas* canvas) SK_OVERRIDE { 112 void onDraw(SkCanvas* canvas) override {
113 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2); 113 canvas->translate(STROKE_WIDTH*3/2, STROKE_WIDTH*3/2);
114 114
115 SkRect r = { 0, 0, 100, 50 }; 115 SkRect r = { 0, 0, 100, 50 };
116 SkScalar scales[] = { SK_Scalar1, 0.6f }; 116 SkScalar scales[] = { SK_Scalar1, 0.6f };
117 117
118 for (size_t s = 0; s < SK_ARRAY_COUNT(scales); ++s) { 118 for (size_t s = 0; s < SK_ARRAY_COUNT(scales); ++s) {
119 canvas->save(); 119 canvas->save();
120 for (size_t f = 0; f < SK_ARRAY_COUNT(fMaskFilters); ++f) { 120 for (size_t f = 0; f < SK_ARRAY_COUNT(fMaskFilters); ++f) {
121 SkPaint paint; 121 SkPaint paint;
122 paint.setMaskFilter(fMaskFilters[f]); 122 paint.setMaskFilter(fMaskFilters[f]);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 class BlurRectFastGM: public BlurRectCompareGM { 323 class BlurRectFastGM: public BlurRectCompareGM {
324 public: 324 public:
325 BlurRectFastGM(const char name[], unsigned int rectWidth, 325 BlurRectFastGM(const char name[], unsigned int rectWidth,
326 unsigned int rectHeight, float blurRadius, 326 unsigned int rectHeight, float blurRadius,
327 SkBlurStyle style) : 327 SkBlurStyle style) :
328 INHERITED(name, rectWidth, rectHeight, blurRadius, style) { 328 INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
329 } 329 }
330 330
331 protected: 331 protected:
332 bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { 332 bool makeMask(SkMask *m, const SkRect& r) override {
333 return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radiu s()), 333 return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radiu s()),
334 m, r, this->style()); 334 m, r, this->style());
335 } 335 }
336 private: 336 private:
337 typedef BlurRectCompareGM INHERITED; 337 typedef BlurRectCompareGM INHERITED;
338 }; 338 };
339 339
340 class BlurRectSlowGM: public BlurRectCompareGM { 340 class BlurRectSlowGM: public BlurRectCompareGM {
341 public: 341 public:
342 BlurRectSlowGM(const char name[], unsigned int rectWidth, unsigned int rectH eight, 342 BlurRectSlowGM(const char name[], unsigned int rectWidth, unsigned int rectH eight,
343 float blurRadius, SkBlurStyle style) 343 float blurRadius, SkBlurStyle style)
344 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) { 344 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
345 } 345 }
346 346
347 protected: 347 protected:
348 bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { 348 bool makeMask(SkMask *m, const SkRect& r) override {
349 SkMask src; 349 SkMask src;
350 r.roundOut(&src.fBounds); 350 r.roundOut(&src.fBounds);
351 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to o rigin 351 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to o rigin
352 src.fFormat = SkMask::kA8_Format; 352 src.fFormat = SkMask::kA8_Format;
353 src.fRowBytes = src.fBounds.width(); 353 src.fRowBytes = src.fBounds.width();
354 src.fImage = SkMask::AllocImage(src.computeTotalImageSize()); 354 src.fImage = SkMask::AllocImage(src.computeTotalImageSize());
355 SkAutoMaskFreeImage amfi(src.fImage); 355 SkAutoMaskFreeImage amfi(src.fImage);
356 356
357 memset(src.fImage, 0xff, src.computeTotalImageSize()); 357 memset(src.fImage, 0xff, src.computeTotalImageSize());
358 358
(...skipping 10 matching lines...) Expand all
369 }; 369 };
370 370
371 class BlurRectSlowLowGM: public BlurRectSlowGM { 371 class BlurRectSlowLowGM: public BlurRectSlowGM {
372 public: 372 public:
373 BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int re ctHeight, 373 BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int re ctHeight,
374 float blurRadius, SkBlurStyle style) 374 float blurRadius, SkBlurStyle style)
375 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) { 375 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
376 } 376 }
377 377
378 protected: 378 protected:
379 SkBlurQuality getQuality() SK_OVERRIDE { 379 SkBlurQuality getQuality() override {
380 return kLow_SkBlurQuality; 380 return kLow_SkBlurQuality;
381 } 381 }
382 private: 382 private:
383 typedef BlurRectSlowGM INHERITED; 383 typedef BlurRectSlowGM INHERITED;
384 }; 384 };
385 385
386 class BlurRectGroundTruthGM: public BlurRectCompareGM { 386 class BlurRectGroundTruthGM: public BlurRectCompareGM {
387 public: 387 public:
388 BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned in t rectHeight, 388 BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned in t rectHeight,
389 float blurRadius, SkBlurStyle style) 389 float blurRadius, SkBlurStyle style)
390 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) { 390 : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
391 } 391 }
392 392
393 protected: 393 protected:
394 bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { 394 bool makeMask(SkMask *m, const SkRect& r) override {
395 SkMask src; 395 SkMask src;
396 r.roundOut(&src.fBounds); 396 r.roundOut(&src.fBounds);
397 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to o rigin 397 src.fBounds.offset(-src.fBounds.fLeft, -src.fBounds.fTop); // move to o rigin
398 src.fFormat = SkMask::kA8_Format; 398 src.fFormat = SkMask::kA8_Format;
399 src.fRowBytes = src.fBounds.width(); 399 src.fRowBytes = src.fBounds.width();
400 src.fImage = SkMask::AllocImage(src.computeTotalImageSize()); 400 src.fImage = SkMask::AllocImage(src.computeTotalImageSize());
401 SkAutoMaskFreeImage amfi(src.fImage); 401 SkAutoMaskFreeImage amfi(src.fImage);
402 402
403 memset(src.fImage, 0xff, src.computeTotalImageSize()); 403 memset(src.fImage, 0xff, src.computeTotalImageSize());
404 404
405 return SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this ->radius()), 405 return SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this ->radius()),
406 m, src, this->style()); 406 m, src, this->style());
407 } 407 }
408 408
409 virtual SkBlurQuality getQuality() { 409 virtual SkBlurQuality getQuality() {
410 return kHigh_SkBlurQuality; 410 return kHigh_SkBlurQuality;
411 } 411 }
412 private: 412 private:
413 typedef BlurRectCompareGM INHERITED; 413 typedef BlurRectCompareGM INHERITED;
414 }; 414 };
415 415
416 416
417 ////////////////////////////////////////////////////////////////////////////// 417 //////////////////////////////////////////////////////////////////////////////
418 418
419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) 419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);)
420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) 420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");)
OLDNEW
« no previous file with comments | « gm/blurquickreject.cpp ('k') | gm/blurroundrect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698