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

Side by Side Diff: tests/BlurTest.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 | « src/animator/SkDrawBlur.cpp ('k') | tests/PaintTest.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 "Test.h" 8 #include "Test.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return true; 95 return true;
96 } 96 }
97 97
98 static void test_blur_drawing(skiatest::Reporter* reporter) { 98 static void test_blur_drawing(skiatest::Reporter* reporter) {
99 99
100 SkPaint paint; 100 SkPaint paint;
101 paint.setColor(SK_ColorGRAY); 101 paint.setColor(SK_ColorGRAY);
102 paint.setStyle(SkPaint::kStroke_Style); 102 paint.setStyle(SkPaint::kStroke_Style);
103 paint.setStrokeWidth(SkIntToScalar(strokeWidth)); 103 paint.setStrokeWidth(SkIntToScalar(strokeWidth));
104 104
105 SkScalar radius = SkIntToScalar(5); 105 SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5));
106 for (int style = 0; style < SkBlurMaskFilter::kBlurStyleCount; ++style) { 106 for (int style = 0; style < SkBlurMaskFilter::kBlurStyleCount; ++style) {
107 SkBlurMaskFilter::BlurStyle blurStyle = 107 SkBlurMaskFilter::BlurStyle blurStyle =
108 static_cast<SkBlurMaskFilter::BlurStyle>(style); 108 static_cast<SkBlurMaskFilter::BlurStyle>(style);
109 109
110 const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag; 110 const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag;
111 for (uint32_t flags = 0; flags < flagPermutations; ++flags) { 111 for (uint32_t flags = 0; flags < flagPermutations; ++flags) {
112 SkMaskFilter* filter; 112 SkMaskFilter* filter;
113 filter = SkBlurMaskFilter::Create(radius, blurStyle, flags); 113 filter = SkBlurMaskFilter::Create(blurStyle, sigma, flags);
114 114
115 paint.setMaskFilter(filter); 115 paint.setMaskFilter(filter);
116 filter->unref(); 116 filter->unref();
117 117
118 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { 118 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) {
119 SkPath path; 119 SkPath path;
120 tests[test].addPath(&path); 120 tests[test].addPath(&path);
121 SkPath strokedPath; 121 SkPath strokedPath;
122 paint.getFillPath(path, &strokedPath); 122 paint.getFillPath(path, &strokedPath);
123 SkRect refBound = strokedPath.getBounds(); 123 SkRect refBound = strokedPath.getBounds();
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 /////////////////////////////////////////////////////////////////////////////// 379 ///////////////////////////////////////////////////////////////////////////////
380 380
381 static void test_blur(skiatest::Reporter* reporter, GrContextFactory* factory) { 381 static void test_blur(skiatest::Reporter* reporter, GrContextFactory* factory) {
382 test_blur_drawing(reporter); 382 test_blur_drawing(reporter);
383 test_sigma_range(reporter, factory); 383 test_sigma_range(reporter, factory);
384 } 384 }
385 385
386 #include "TestClassDef.h" 386 #include "TestClassDef.h"
387 DEFINE_GPUTESTCLASS("BlurMaskFilter", BlurTestClass, test_blur) 387 DEFINE_GPUTESTCLASS("BlurMaskFilter", BlurTestClass, test_blur)
OLDNEW
« no previous file with comments | « src/animator/SkDrawBlur.cpp ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698