| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 (already done 255-x). | 675 (already done 255-x). |
| 676 | 676 |
| 677 It's the responsibility of the caller to delete the | 677 It's the responsibility of the caller to delete the |
| 678 memory returned in profile_out. | 678 memory returned in profile_out. |
| 679 */ | 679 */ |
| 680 | 680 |
| 681 void SkBlurMask::ComputeBlurProfile(SkScalar sigma, uint8_t **profile_out) { | 681 void SkBlurMask::ComputeBlurProfile(SkScalar sigma, uint8_t **profile_out) { |
| 682 int size = SkScalarCeilToInt(6*sigma); | 682 int size = SkScalarCeilToInt(6*sigma); |
| 683 | 683 |
| 684 int center = size >> 1; | 684 int center = size >> 1; |
| 685 uint8_t *profile = SkNEW_ARRAY(uint8_t, size); | 685 uint8_t* profile = new uint8_t[size]; |
| 686 | 686 |
| 687 float invr = 1.f/(2*sigma); | 687 float invr = 1.f/(2*sigma); |
| 688 | 688 |
| 689 profile[0] = 255; | 689 profile[0] = 255; |
| 690 for (int x = 1 ; x < size ; ++x) { | 690 for (int x = 1 ; x < size ; ++x) { |
| 691 float scaled_x = (center - x - .5f) * invr; | 691 float scaled_x = (center - x - .5f) * invr; |
| 692 float gi = gaussianIntegral(scaled_x); | 692 float gi = gaussianIntegral(scaled_x); |
| 693 profile[x] = 255 - (uint8_t) (255.f * gi); | 693 profile[x] = 255 - (uint8_t) (255.f * gi); |
| 694 } | 694 } |
| 695 | 695 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 (void)autoCall.detach(); | 987 (void)autoCall.detach(); |
| 988 } | 988 } |
| 989 | 989 |
| 990 if (style == kInner_SkBlurStyle) { | 990 if (style == kInner_SkBlurStyle) { |
| 991 dst->fBounds = src.fBounds; // restore trimmed bounds | 991 dst->fBounds = src.fBounds; // restore trimmed bounds |
| 992 dst->fRowBytes = src.fRowBytes; | 992 dst->fRowBytes = src.fRowBytes; |
| 993 } | 993 } |
| 994 | 994 |
| 995 return true; | 995 return true; |
| 996 } | 996 } |
| OLD | NEW |