| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 SkScalar radius = SkIntToScalar(5); | 98 SkScalar radius = SkIntToScalar(5); |
| 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(radius, blurStyle, flags); |
| 107 | 107 |
| 108 SkMaskFilter::BlurInfo info; | |
| 109 sk_bzero(&info, sizeof(info)); | |
| 110 SkMaskFilter::BlurType type = filter->asABlur(&info); | |
| 111 | |
| 112 REPORTER_ASSERT(reporter, type == | |
| 113 static_cast<SkMaskFilter::BlurType>(style + 1)); | |
| 114 REPORTER_ASSERT(reporter, info.fRadius == radius); | |
| 115 REPORTER_ASSERT(reporter, info.fIgnoreTransform == | |
| 116 SkToBool(flags & SkBlurMaskFilter::kIgnoreTransform_BlurFlag)); | |
| 117 REPORTER_ASSERT(reporter, info.fHighQuality == | |
| 118 SkToBool(flags & SkBlurMaskFilter::kHighQuality_BlurFlag)); | |
| 119 | |
| 120 paint.setMaskFilter(filter); | 108 paint.setMaskFilter(filter); |
| 121 filter->unref(); | 109 filter->unref(); |
| 122 | 110 |
| 123 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { | 111 for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { |
| 124 SkPath path; | 112 SkPath path; |
| 125 tests[test].addPath(&path); | 113 tests[test].addPath(&path); |
| 126 SkPath strokedPath; | 114 SkPath strokedPath; |
| 127 paint.getFillPath(path, &strokedPath); | 115 paint.getFillPath(path, &strokedPath); |
| 128 SkRect refBound = strokedPath.getBounds(); | 116 SkRect refBound = strokedPath.getBounds(); |
| 129 SkIRect iref; | 117 SkIRect iref; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 152 REPORTER_ASSERT(reporter, | 140 REPORTER_ASSERT(reporter, |
| 153 compare(refBitmap, iref, testBitmap, itest)); | 141 compare(refBitmap, iref, testBitmap, itest)); |
| 154 } | 142 } |
| 155 } | 143 } |
| 156 } | 144 } |
| 157 } | 145 } |
| 158 } | 146 } |
| 159 | 147 |
| 160 #include "TestClassDef.h" | 148 #include "TestClassDef.h" |
| 161 DEFINE_TESTCLASS("BlurMaskFilter", BlurTestClass, test_blur) | 149 DEFINE_TESTCLASS("BlurMaskFilter", BlurTestClass, test_blur) |
| OLD | NEW |