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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 478 bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, |
479 SkScalar sigma, Style style, Quality quality, | 479 SkScalar sigma, Style style, Quality quality, |
480 SkIPoint* margin) { | 480 SkIPoint* margin, bool force_quality) { |
481 | 481 |
482 if (src.fFormat != SkMask::kA8_Format) { | 482 if (src.fFormat != SkMask::kA8_Format) { |
483 return false; | 483 return false; |
484 } | 484 } |
485 | 485 |
486 // Force high quality off for small radii (performance) | 486 // Force high quality off for small radii (performance) |
487 if (sigma <= SkIntToScalar(2)) { | 487 if (!force_quality && sigma <= SkIntToScalar(2)) { |
488 quality = kLow_Quality; | 488 quality = kLow_Quality; |
489 } | 489 } |
490 | 490 |
491 SkScalar passRadius; | 491 SkScalar passRadius; |
492 if (kHigh_Quality == quality) { | 492 if (kHigh_Quality == quality) { |
493 // 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 |
494 // 6*rad+1 while the full Gaussian width is 6*sigma. | 494 // 6*rad+1 while the full Gaussian width is 6*sigma. |
495 passRadius = sigma - (1/6.0f); | 495 passRadius = sigma - (1/6.0f); |
496 } else { | 496 } else { |
497 // 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... |
983 (void)autoCall.detach(); | 983 (void)autoCall.detach(); |
984 } | 984 } |
985 | 985 |
986 if (style == kInner_Style) { | 986 if (style == kInner_Style) { |
987 dst->fBounds = src.fBounds; // restore trimmed bounds | 987 dst->fBounds = src.fBounds; // restore trimmed bounds |
988 dst->fRowBytes = src.fRowBytes; | 988 dst->fRowBytes = src.fRowBytes; |
989 } | 989 } |
990 | 990 |
991 return true; | 991 return true; |
992 } | 992 } |
OLD | NEW |