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

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

Issue 253633003: add asAShadowBlur for android to drawlooper (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add unittests (and fix bugs in layerdrawlooper) Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkBlurMask.h ('k') | 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"
11 #include "SkMath.h" 11 #include "SkMath.h"
12 #include "SkTemplates.h" 12 #include "SkTemplates.h"
13 #include "SkEndian.h" 13 #include "SkEndian.h"
14 14
15 15
16 // This constant approximates the scaling done in the software path's
17 // "high quality" mode, in SkBlurMask::Blur() (1 / sqrt(3)).
18 // IMHO, it actually should be 1: we blur "less" than we should do
19 // according to the CSS and canvas specs, simply because Safari does the same.
20 // Firefox used to do the same too, until 4.0 where they fixed it. So at some
21 // point we should probably get rid of these scaling constants and rebaseline
22 // all the blur tests.
23 static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;
24
16 SkScalar SkBlurMask::ConvertRadiusToSigma(SkScalar radius) { 25 SkScalar SkBlurMask::ConvertRadiusToSigma(SkScalar radius) {
17 // This constant approximates the scaling done in the software path's 26 return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f;
18 // "high quality" mode, in SkBlurMask::Blur() (1 / sqrt(3)). 27 }
19 // IMHO, it actually should be 1: we blur "less" than we should do
20 // according to the CSS and canvas specs, simply because Safari does the sam e.
21 // Firefox used to do the same too, until 4.0 where they fixed it. So at so me
22 // point we should probably get rid of these scaling constants and rebaselin e
23 // all the blur tests.
24 static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f;
25 28
26 return radius ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f; 29 SkScalar SkBlurMask::ConvertSigmaToRadius(SkScalar sigma) {
30 return sigma > 0.5f ? (sigma - 0.5f) / kBLUR_SIGMA_SCALE : 0.0f;
27 } 31 }
28 32
29 #define UNROLL_SEPARABLE_LOOPS 33 #define UNROLL_SEPARABLE_LOOPS
30 34
31 /** 35 /**
32 * This function performs a box blur in X, of the given radius. If the 36 * This function performs a box blur in X, of the given radius. If the
33 * "transpose" parameter is true, it will transpose the pixels on write, 37 * "transpose" parameter is true, it will transpose the pixels on write,
34 * such that X and Y are swapped. Reads are always performed from contiguous 38 * such that X and Y are swapped. Reads are always performed from contiguous
35 * memory in X, for speed. The destination buffer (dst) must be at least 39 * memory in X, for speed. The destination buffer (dst) must be at least
36 * (width + leftRadius + rightRadius) * height bytes in size. 40 * (width + leftRadius + rightRadius) * height bytes in size.
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 (void)autoCall.detach(); 987 (void)autoCall.detach();
984 } 988 }
985 989
986 if (style == kInner_SkBlurStyle) { 990 if (style == kInner_SkBlurStyle) {
987 dst->fBounds = src.fBounds; // restore trimmed bounds 991 dst->fBounds = src.fBounds; // restore trimmed bounds
988 dst->fRowBytes = src.fRowBytes; 992 dst->fRowBytes = src.fRowBytes;
989 } 993 }
990 994
991 return true; 995 return true;
992 } 996 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMask.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698