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

Side by Side Diff: gm/blurroundrect.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/blurrect.cpp ('k') | gm/blurs.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 2013 Google Inc. 2 * Copyright 2013 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 24 matching lines...) Expand all
35 fName.appendf("-WH-%ix%i-unevenCorners", width, height); 35 fName.appendf("-WH-%ix%i-unevenCorners", width, height);
36 SkVector radii[4]; 36 SkVector radii[4];
37 radii[0].set(SkIntToScalar(30), SkIntToScalar(30)); 37 radii[0].set(SkIntToScalar(30), SkIntToScalar(30));
38 radii[1].set(SkIntToScalar(10), SkIntToScalar(10)); 38 radii[1].set(SkIntToScalar(10), SkIntToScalar(10));
39 radii[2].set(SkIntToScalar(30), SkIntToScalar(30)); 39 radii[2].set(SkIntToScalar(30), SkIntToScalar(30));
40 radii[3].set(SkIntToScalar(10), SkIntToScalar(10)); 40 radii[3].set(SkIntToScalar(10), SkIntToScalar(10));
41 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); 41 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
42 fRRect.setRectRadii(r, radii); 42 fRRect.setRectRadii(r, radii);
43 } 43 }
44 44
45 virtual SkString onShortName() SK_OVERRIDE { 45 SkString onShortName() SK_OVERRIDE {
46 return fName; 46 return fName;
47 } 47 }
48 48
49 virtual SkISize onISize() SK_OVERRIDE { 49 SkISize onISize() SK_OVERRIDE {
50 return SkISize::Make(SkScalarCeilToInt(fRRect.rect().width()), 50 return SkISize::Make(SkScalarCeilToInt(fRRect.rect().width()),
51 SkScalarCeilToInt(fRRect.rect().height())); 51 SkScalarCeilToInt(fRRect.rect().height()));
52 } 52 }
53 53
54 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 54 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
55 SkLayerDrawLooper::Builder looperBuilder; 55 SkLayerDrawLooper::Builder looperBuilder;
56 { 56 {
57 SkLayerDrawLooper::LayerInfo info; 57 SkLayerDrawLooper::LayerInfo info;
58 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit 58 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
59 | SkLayerDrawLooper::kColorFilter_Bit; 59 | SkLayerDrawLooper::kColorFilter_Bit;
60 info.fColorMode = SkXfermode::kSrc_Mode; 60 info.fColorMode = SkXfermode::kSrc_Mode;
61 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); 61 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
62 info.fPostTranslate = false; 62 info.fPostTranslate = false;
63 SkPaint* paint = looperBuilder.addLayerOnTop(info); 63 SkPaint* paint = looperBuilder.addLayerOnTop(info);
64 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create( 64 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 // Simpler blurred RR test cases where all the radii are the same. 121 // Simpler blurred RR test cases where all the radii are the same.
122 class SimpleBlurRoundRectGM : public skiagm::GM { 122 class SimpleBlurRoundRectGM : public skiagm::GM {
123 public: 123 public:
124 SimpleBlurRoundRectGM() 124 SimpleBlurRoundRectGM()
125 : fName("simpleblurroundrect") { 125 : fName("simpleblurroundrect") {
126 } 126 }
127 127
128 protected: 128 protected:
129 virtual uint32_t onGetFlags() const SK_OVERRIDE { 129 uint32_t onGetFlags() const SK_OVERRIDE {
130 return kSkipTiled_Flag; 130 return kSkipTiled_Flag;
131 } 131 }
132 132
133 virtual SkString onShortName() SK_OVERRIDE { 133 SkString onShortName() SK_OVERRIDE {
134 return fName; 134 return fName;
135 } 135 }
136 136
137 virtual SkISize onISize() SK_OVERRIDE { 137 SkISize onISize() SK_OVERRIDE {
138 return SkISize::Make(1000, 500); 138 return SkISize::Make(1000, 500);
139 } 139 }
140 140
141 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 141 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
142 canvas->scale(1.5f, 1.5f); 142 canvas->scale(1.5f, 1.5f);
143 canvas->translate(50,50); 143 canvas->translate(50,50);
144 144
145 const float blurRadii[] = { 1,5,10,20 }; 145 const float blurRadii[] = { 1,5,10,20 };
146 const int cornerRadii[] = { 1,5,10,20 }; 146 const int cornerRadii[] = { 1,5,10,20 };
147 const SkRect r = SkRect::MakeWH(SkIntToScalar(25), SkIntToScalar(25)); 147 const SkRect r = SkRect::MakeWH(SkIntToScalar(25), SkIntToScalar(25));
148 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) { 148 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
149 SkAutoCanvasRestore autoRestore(canvas, true); 149 SkAutoCanvasRestore autoRestore(canvas, true);
150 canvas->translate(0, (r.height() + SkIntToScalar(50)) * i); 150 canvas->translate(0, (r.height() + SkIntToScalar(50)) * i);
151 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) { 151 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // TODO(scroggo): Disabled in an attempt to rememdy 183 // TODO(scroggo): Disabled in an attempt to rememdy
184 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs: 184 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs:
185 // ran wrong number of tests') 185 // ran wrong number of tests')
186 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) 186 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);)
187 187
188 // Rounded rect with two opposite corners with large radii, the other two 188 // Rounded rect with two opposite corners with large radii, the other two
189 // small. 189 // small.
190 DEF_GM(return new BlurRoundRectGM(100, 100);) 190 DEF_GM(return new BlurRoundRectGM(100, 100);)
191 191
192 DEF_GM(return new SimpleBlurRoundRectGM();) 192 DEF_GM(return new SimpleBlurRoundRectGM();)
OLDNEW
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/blurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698