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

Side by Side Diff: samplecode/SampleFuzz.cpp

Issue 23701006: Push sigma-based blur interface into our GMs/benches/tests/samplecode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleEmboss.cpp ('k') | samplecode/SampleSlides.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 #if defined _WIN32 54 #if defined _WIN32
55 #pragma warning ( pop ) 55 #pragma warning ( pop )
56 #endif 56 #endif
57 57
58 static float make_number() { 58 static float make_number() {
59 float v = 0; 59 float v = 0;
60 int sel; 60 int sel;
61 61
62 if (return_large == true && R(3) == 1) sel = R(6); else sel = R(4); 62 if (return_large == true && R(3) == 1) {
63 if (return_undef == false && sel == 0) sel = 1; 63 sel = R(6);
64 64 } else {
65 if (R(2) == 1) v = (float)R(100); else 65 sel = R(4);
66
67 switch (sel) {
68 case 0: break;
69 case 1: v = 0; break;
70 case 2: v = 0.000001f; break;
71 case 3: v = 10000; break;
72 case 4: v = 2000000000; break;
73 case 5: v = huge(); break;
74 } 66 }
75 67
76 if (R(4) == 1) v = -v; 68 if (return_undef == false && sel == 0) {
69 sel = 1;
70 }
71
72 if (R(2) == 1) {
73 v = (float)R(100);
74 } else {
75
76 switch (sel) {
77 case 0: break;
78 case 1: v = 0; break;
79 case 2: v = 0.000001f; break;
80 case 3: v = 10000; break;
81 case 4: v = 2000000000; break;
82 case 5: v = huge(); break;
83 }
84
85 }
86
87 if (R(4) == 1) {
88 v = -v;
89 }
90
77 return v; 91 return v;
78 } 92 }
79 93
80 static SkColor make_color() { 94 static SkColor make_color() {
81 if (R(2) == 1) return 0xFFC0F0A0; else return 0xFF000090; 95 if (R(2) == 1) return 0xFFC0F0A0; else return 0xFF000090;
82 } 96 }
83 97
84 98
85 static SkColor make_fill() { 99 static SkColor make_fill() {
86 #if 0 100 #if 0
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 case 5: 183 case 5:
170 paint.setStrokeWidth(make_number()); 184 paint.setStrokeWidth(make_number());
171 break; 185 break;
172 186
173 case 6: 187 case 6:
174 paint.setStrokeMiter(make_number()); 188 paint.setStrokeMiter(make_number());
175 break; 189 break;
176 190
177 case 7: 191 case 7:
178 if (quick == true) break; 192 if (quick == true) break;
179 SkSafeUnref(paint.setMaskFilter(SkBlurMaskFilter::Create(make_number() , SkBlurMaskFilter::kNormal_BlurStyle))); 193 SkSafeUnref(paint.setMaskFilter(SkBlurMaskFilter::Create(
194 SkBlurMaskFilter::kNormal_Blur Style,
195 make_number())));
180 break; 196 break;
181 197
182 case 8: 198 case 8:
183 if (quick == true) break; 199 if (quick == true) break;
184 //ctx.shadowColor = make_fill(); 200 //ctx.shadowColor = make_fill();
185 break; 201 break;
186 202
187 case 9: 203 case 9:
188 if (quick == true) break; 204 if (quick == true) break;
189 //ctx.shadowOffsetX = make_number(); 205 //ctx.shadowOffsetX = make_number();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 388 }
373 389
374 private: 390 private:
375 typedef SkView INHERITED; 391 typedef SkView INHERITED;
376 }; 392 };
377 393
378 ////////////////////////////////////////////////////////////////////////////// 394 //////////////////////////////////////////////////////////////////////////////
379 395
380 static SkView* MyFactory() { return new FuzzView; } 396 static SkView* MyFactory() { return new FuzzView; }
381 static SkViewRegister reg(MyFactory); 397 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleEmboss.cpp ('k') | samplecode/SampleSlides.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698