OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // fractional phase on the fRight or fBottom of our smallR. | 285 // fractional phase on the fRight or fBottom of our smallR. |
286 const SkScalar dx = SkIntToScalar(innerIR.width() - smallW); | 286 const SkScalar dx = SkIntToScalar(innerIR.width() - smallW); |
287 const SkScalar dy = SkIntToScalar(innerIR.height() - smallH); | 287 const SkScalar dy = SkIntToScalar(innerIR.height() - smallH); |
288 if (dx < 0 || dy < 0) { | 288 if (dx < 0 || dy < 0) { |
289 // we're too small, relative to our blur, to break into nine-patch, | 289 // we're too small, relative to our blur, to break into nine-patch, |
290 // so we ask to have our normal filterMask() be called. | 290 // so we ask to have our normal filterMask() be called. |
291 return kUnimplemented_FilterReturn; | 291 return kUnimplemented_FilterReturn; |
292 } | 292 } |
293 | 293 |
294 smallR[0].set(rects[0].left(), rects[0].top(), rects[0].right() - dx, rects[
0].bottom() - dy); | 294 smallR[0].set(rects[0].left(), rects[0].top(), rects[0].right() - dx, rects[
0].bottom() - dy); |
295 SkASSERT(!smallR[0].isEmpty()); | 295 if (smallR[0].width() < 2 || smallR[0].height() < 2) { |
| 296 return kUnimplemented_FilterReturn; |
| 297 } |
296 if (2 == count) { | 298 if (2 == count) { |
297 smallR[1].set(rects[1].left(), rects[1].top(), | 299 smallR[1].set(rects[1].left(), rects[1].top(), |
298 rects[1].right() - dx, rects[1].bottom() - dy); | 300 rects[1].right() - dx, rects[1].bottom() - dy); |
299 SkASSERT(!smallR[1].isEmpty()); | 301 SkASSERT(!smallR[1].isEmpty()); |
300 } | 302 } |
301 | 303 |
302 if (count > 1 || !c_analyticBlurNinepatch) { | 304 if (count > 1 || !c_analyticBlurNinepatch) { |
303 if (!drawRectsIntoMask(smallR, count, &srcM)) { | 305 if (!drawRectsIntoMask(smallR, count, &srcM)) { |
304 return kFalse_FilterReturn; | 306 return kFalse_FilterReturn; |
305 } | 307 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 } else { | 473 } else { |
472 str->append("None"); | 474 str->append("None"); |
473 } | 475 } |
474 str->append("))"); | 476 str->append("))"); |
475 } | 477 } |
476 #endif | 478 #endif |
477 | 479 |
478 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
479 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 481 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
480 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 482 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |