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

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

Issue 1378023004: Refugee from Dead Machine 2: Have GrRectBlurEffect use Linear filtering (rather than Nearest Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 7 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 | no next file » | 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkMath.h" 10 #include "SkMath.h"
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 all the time, we actually fill in the profile pre-inverted 673 all the time, we actually fill in the profile pre-inverted
674 (already done 255-x). 674 (already done 255-x).
675 675
676 It's the responsibility of the caller to delete the 676 It's the responsibility of the caller to delete the
677 memory returned in profile_out. 677 memory returned in profile_out.
678 */ 678 */
679 679
680 uint8_t* SkBlurMask::ComputeBlurProfile(SkScalar sigma) { 680 uint8_t* SkBlurMask::ComputeBlurProfile(SkScalar sigma) {
681 int size = SkScalarCeilToInt(6*sigma); 681 int size = SkScalarCeilToInt(6*sigma);
682 682
683 int center = size >> 1; 683 float center = 0.5f * size;
684 uint8_t* profile = new uint8_t[size]; 684 uint8_t* profile = new uint8_t[size];
685 685
686 float invr = 1.f/(2*sigma); 686 float invr = 1.f/(2*sigma);
687 687
688 profile[0] = 255; 688 profile[0] = 255;
689 for (int x = 1 ; x < size ; ++x) { 689 for (int x = 1 ; x < size ; ++x) {
690 float scaled_x = (center - x - .5f) * invr; 690 float scaled_x = (center - x - .5f) * invr;
691 float gi = gaussianIntegral(scaled_x); 691 float gi = gaussianIntegral(scaled_x);
692 profile[x] = 255 - (uint8_t) (255.f * gi); 692 profile[x] = 255 - (uint8_t) (255.f * gi);
693 } 693 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 (void)autoCall.release(); 984 (void)autoCall.release();
985 } 985 }
986 986
987 if (style == kInner_SkBlurStyle) { 987 if (style == kInner_SkBlurStyle) {
988 dst->fBounds = src.fBounds; // restore trimmed bounds 988 dst->fBounds = src.fBounds; // restore trimmed bounds
989 dst->fRowBytes = src.fRowBytes; 989 dst->fRowBytes = src.fRowBytes;
990 } 990 }
991 991
992 return true; 992 return true;
993 } 993 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698