| OLD | NEW |
| 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 "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void test_blur(skiatest::Reporter* reporter) { | 91 static void test_blur(skiatest::Reporter* reporter) { |
| 92 | 92 |
| 93 SkPaint paint; | 93 SkPaint paint; |
| 94 paint.setColor(SK_ColorGRAY); | 94 paint.setColor(SK_ColorGRAY); |
| 95 paint.setStyle(SkPaint::kStroke_Style); | 95 paint.setStyle(SkPaint::kStroke_Style); |
| 96 paint.setStrokeWidth(SkIntToScalar(strokeWidth)); | 96 paint.setStrokeWidth(SkIntToScalar(strokeWidth)); |
| 97 | 97 |
| 98 SkScalar radius = SkIntToScalar(5); | 98 SkScalar sigma = SkFloatToScalar(3.38675f); |
| 99 for (int style = 0; style < SkBlurMaskFilter::kBlurStyleCount; ++style) { | 99 for (int style = 0; style < SkBlurMaskFilter::kBlurStyleCount; ++style) { |
| 100 SkBlurMaskFilter::BlurStyle blurStyle = | 100 SkBlurMaskFilter::BlurStyle blurStyle = |
| 101 static_cast<SkBlurMaskFilter::BlurStyle>(style); | 101 static_cast<SkBlurMaskFilter::BlurStyle>(style); |
| 102 | 102 |
| 103 const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag; | 103 const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag; |
| 104 for (uint32_t flags = 0; flags < flagPermutations; ++flags) { | 104 for (uint32_t flags = 0; flags < flagPermutations; ++flags) { |
| 105 SkMaskFilter* filter; | 105 SkMaskFilter* filter; |
| 106 filter = SkBlurMaskFilter::Create(radius, blurStyle, flags); | 106 filter = SkBlurMaskFilter::Create(blurStyle, sigma, flags); |
| 107 | 107 |
| 108 paint.setMaskFilter(filter); | 108 paint.setMaskFilter(filter); |
| 109 filter->unref(); | 109 filter->unref(); |
| 110 | 110 |
| 111 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { | 111 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { |
| 112 SkPath path; | 112 SkPath path; |
| 113 tests[test].addPath(&path); | 113 tests[test].addPath(&path); |
| 114 SkPath strokedPath; | 114 SkPath strokedPath; |
| 115 paint.getFillPath(path, &strokedPath); | 115 paint.getFillPath(path, &strokedPath); |
| 116 SkRect refBound = strokedPath.getBounds(); | 116 SkRect refBound = strokedPath.getBounds(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 140 REPORTER_ASSERT(reporter, | 140 REPORTER_ASSERT(reporter, |
| 141 compare(refBitmap, iref, testBitmap, itest)); | 141 compare(refBitmap, iref, testBitmap, itest)); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 #include "TestClassDef.h" | 148 #include "TestClassDef.h" |
| 149 DEFINE_TESTCLASS("BlurMaskFilter", BlurTestClass, test_blur) | 149 DEFINE_TESTCLASS("BlurMaskFilter", BlurTestClass, test_blur) |
| OLD | NEW |