| 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 | 9 |
| 10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 /////////////////////////////////////////////////////////////////////////////// | 469 /////////////////////////////////////////////////////////////////////////////// |
| 470 | 470 |
| 471 // we use a local function to wrap the class static method to work around | 471 // we use a local function to wrap the class static method to work around |
| 472 // a bug in gcc98 | 472 // a bug in gcc98 |
| 473 void SkMask_FreeImage(uint8_t* image); | 473 void SkMask_FreeImage(uint8_t* image); |
| 474 void SkMask_FreeImage(uint8_t* image) { | 474 void SkMask_FreeImage(uint8_t* image) { |
| 475 SkMask::FreeImage(image); | 475 SkMask::FreeImage(image); |
| 476 } | 476 } |
| 477 | 477 |
| 478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurS
tyle style, | 478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, |
| 479 SkBlurQuality quality, SkIPoint* margin) { | 479 SkScalar sigma, SkBlurStyle style, SkBlurQuality qualit
y, |
| 480 SkIPoint* margin, bool force_quality) { |
| 481 |
| 480 if (src.fFormat != SkMask::kA8_Format) { | 482 if (src.fFormat != SkMask::kA8_Format) { |
| 481 return false; | 483 return false; |
| 482 } | 484 } |
| 483 | 485 |
| 484 // Force high quality off for small radii (performance) | 486 // Force high quality off for small radii (performance) |
| 485 if (sigma <= SkIntToScalar(2)) { | 487 if (!force_quality && sigma <= SkIntToScalar(2)) { |
| 486 quality = kLow_SkBlurQuality; | 488 quality = kLow_SkBlurQuality; |
| 487 } | 489 } |
| 488 | 490 |
| 489 SkScalar passRadius; | 491 SkScalar passRadius; |
| 490 if (kHigh_SkBlurQuality == quality) { | 492 if (kHigh_SkBlurQuality == quality) { |
| 491 // For the high quality path the 3 pass box blur kernel width is | 493 // For the high quality path the 3 pass box blur kernel width is |
| 492 // 6*rad+1 while the full Gaussian width is 6*sigma. | 494 // 6*rad+1 while the full Gaussian width is 6*sigma. |
| 493 passRadius = sigma - (1/6.0f); | 495 passRadius = sigma - (1/6.0f); |
| 494 } else { | 496 } else { |
| 495 // For the low quality path we only attempt to cover 3*sigma of the | 497 // For the low quality path we only attempt to cover 3*sigma of the |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 (void)autoCall.detach(); | 983 (void)autoCall.detach(); |
| 982 } | 984 } |
| 983 | 985 |
| 984 if (style == kInner_SkBlurStyle) { | 986 if (style == kInner_SkBlurStyle) { |
| 985 dst->fBounds = src.fBounds; // restore trimmed bounds | 987 dst->fBounds = src.fBounds; // restore trimmed bounds |
| 986 dst->fRowBytes = src.fRowBytes; | 988 dst->fRowBytes = src.fRowBytes; |
| 987 } | 989 } |
| 988 | 990 |
| 989 return true; | 991 return true; |
| 990 } | 992 } |
| OLD | NEW |