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

Side by Side Diff: gm/blurcircles.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 | « gm/bleed.cpp ('k') | gm/blurquickreject.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 2014 Google Inc. 2 * Copyright 2014 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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 14
15 class BlurCirclesGM : public skiagm::GM { 15 class BlurCirclesGM : public skiagm::GM {
16 public: 16 public:
17 BlurCirclesGM() 17 BlurCirclesGM()
18 : fName("blurcircles") { 18 : fName("blurcircles") {
19 } 19 }
20 20
21 protected: 21 protected:
22 virtual uint32_t onGetFlags() const SK_OVERRIDE { 22 uint32_t onGetFlags() const SK_OVERRIDE {
23 return kSkipTiled_Flag; 23 return kSkipTiled_Flag;
24 } 24 }
25 25
26 virtual SkString onShortName() SK_OVERRIDE { 26 SkString onShortName() SK_OVERRIDE {
27 return fName; 27 return fName;
28 } 28 }
29 29
30 virtual SkISize onISize() SK_OVERRIDE { 30 SkISize onISize() SK_OVERRIDE {
31 return SkISize::Make(950, 950); 31 return SkISize::Make(950, 950);
32 } 32 }
33 33
34 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 34 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
35 canvas->scale(1.5f, 1.5f); 35 canvas->scale(1.5f, 1.5f);
36 canvas->translate(50,50); 36 canvas->translate(50,50);
37 37
38 const float blurRadii[] = { 1,5,10,20 }; 38 const float blurRadii[] = { 1,5,10,20 };
39 const int circleRadii[] = { 5,10,25,50 }; 39 const int circleRadii[] = { 5,10,25,50 };
40 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) { 40 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
41 SkAutoCanvasRestore autoRestore(canvas, true); 41 SkAutoCanvasRestore autoRestore(canvas, true);
42 canvas->translate(0, SkIntToScalar(150*i)); 42 canvas->translate(0, SkIntToScalar(150*i));
43 for (size_t j = 0; j < SK_ARRAY_COUNT(circleRadii); ++j) { 43 for (size_t j = 0; j < SK_ARRAY_COUNT(circleRadii); ++j) {
44 SkMaskFilter* filter = SkBlurMaskFilter::Create( 44 SkMaskFilter* filter = SkBlurMaskFilter::Create(
45 kNormal_SkBlurStyle, 45 kNormal_SkBlurStyle,
46 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ), 46 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ),
47 SkBlurMaskFilter::kHighQuality_BlurFlag); 47 SkBlurMaskFilter::kHighQuality_BlurFlag);
48 SkPaint paint; 48 SkPaint paint;
49 paint.setColor(SK_ColorBLACK); 49 paint.setColor(SK_ColorBLACK);
50 paint.setMaskFilter(filter)->unref(); 50 paint.setMaskFilter(filter)->unref();
51 51
52 canvas->drawCircle(SkIntToScalar(50),SkIntToScalar(50),SkIntToSc alar(circleRadii[j]),paint); 52 canvas->drawCircle(SkIntToScalar(50),SkIntToScalar(50),SkIntToSc alar(circleRadii[j]),paint);
53 canvas->translate(SkIntToScalar(150), 0); 53 canvas->translate(SkIntToScalar(150), 0);
54 } 54 }
55 } 55 }
56 } 56 }
57 private: 57 private:
58 const SkString fName; 58 const SkString fName;
59 59
60 typedef skiagm::GM INHERITED; 60 typedef skiagm::GM INHERITED;
61 }; 61 };
62 62
63 DEF_GM(return new BlurCirclesGM();) 63 DEF_GM(return new BlurCirclesGM();)
OLDNEW
« no previous file with comments | « gm/bleed.cpp ('k') | gm/blurquickreject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698