Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: src/effects/SkBlurMask.cpp

Issue 1378813004: Revert of Have GrRectBlurEffect use Linear filtering (rather than Nearest Neighbor) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 all the time, we actually fill in the profile pre-inverted 674 all the time, we actually fill in the profile pre-inverted
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 uint8_t* SkBlurMask::ComputeBlurProfile(SkScalar sigma) { 681 uint8_t* SkBlurMask::ComputeBlurProfile(SkScalar sigma) {
682 int size = SkScalarCeilToInt(6*sigma); 682 int size = SkScalarCeilToInt(6*sigma);
683 683
684 float center = 0.5f * size; 684 int center = size >> 1;
685 uint8_t* profile = new 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 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 (void)autoCall.detach(); 985 (void)autoCall.detach();
986 } 986 }
987 987
988 if (style == kInner_SkBlurStyle) { 988 if (style == kInner_SkBlurStyle) {
989 dst->fBounds = src.fBounds; // restore trimmed bounds 989 dst->fBounds = src.fBounds; // restore trimmed bounds
990 dst->fRowBytes = src.fRowBytes; 990 dst->fRowBytes = src.fRowBytes;
991 } 991 }
992 992
993 return true; 993 return true;
994 } 994 }
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698