OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurMask.h" | 8 #include "SkBlurMask.h" |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurDrawLooper.h" | 10 #include "SkBlurDrawLooper.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 int* result, int resultCount) { | 163 int* result, int resultCount) { |
164 SkMask src, dst; | 164 SkMask src, dst; |
165 | 165 |
166 src.fBounds.set(0, 0, width, height); | 166 src.fBounds.set(0, 0, width, height); |
167 src.fFormat = SkMask::kA8_Format; | 167 src.fFormat = SkMask::kA8_Format; |
168 src.fRowBytes = src.fBounds.width(); | 168 src.fRowBytes = src.fBounds.width(); |
169 src.fImage = SkMask::AllocImage(src.computeTotalImageSize()); | 169 src.fImage = SkMask::AllocImage(src.computeTotalImageSize()); |
170 | 170 |
171 memset(src.fImage, 0xff, src.computeTotalImageSize()); | 171 memset(src.fImage, 0xff, src.computeTotalImageSize()); |
172 | 172 |
173 dst.fImage = nullptr; | 173 if (!SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle)) { |
174 SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle); | 174 return; |
| 175 } |
175 | 176 |
176 int midX = dst.fBounds.centerX(); | 177 int midX = dst.fBounds.centerX(); |
177 int midY = dst.fBounds.centerY(); | 178 int midY = dst.fBounds.centerY(); |
178 uint8_t* bytes = dst.getAddr8(midX, midY); | 179 uint8_t* bytes = dst.getAddr8(midX, midY); |
179 int i; | 180 int i; |
180 for (i = 0; i < dst.fBounds.width()-(midX-dst.fBounds.fLeft); ++i) { | 181 for (i = 0; i < dst.fBounds.width()-(midX-dst.fBounds.fLeft); ++i) { |
181 if (i < resultCount) { | 182 if (i < resultCount) { |
182 result[i] = bytes[i]; | 183 result[i] = bytes[i]; |
183 } | 184 } |
184 } | 185 } |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 if (mf.get()) { | 552 if (mf.get()) { |
552 SkMaskFilter::BlurRec rec; | 553 SkMaskFilter::BlurRec rec; |
553 bool success = mf->asABlur(&rec); | 554 bool success = mf->asABlur(&rec); |
554 REPORTER_ASSERT(reporter, !success); | 555 REPORTER_ASSERT(reporter, !success); |
555 } | 556 } |
556 } | 557 } |
557 } | 558 } |
558 } | 559 } |
559 | 560 |
560 ////////////////////////////////////////////////////////////////////////////////
/////////// | 561 ////////////////////////////////////////////////////////////////////////////////
/////////// |
OLD | NEW |