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

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

Issue 1893973002: Outline SkImageFilter Make methods (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 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 | « src/core/SkLocalMatrixImageFilter.cpp ('k') | src/effects/SkComposeImageFilter.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 * Copyright 2011 The Android Open Source Project 2 * Copyright 2011 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 #include "SkBlurImageFilter.h" 8 #include "SkBlurImageFilter.h"
9 9
10 #include "SkAutoPixmapStorage.h" 10 #include "SkAutoPixmapStorage.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkGpuBlurUtils.h" 12 #include "SkGpuBlurUtils.h"
13 #include "SkOpts.h" 13 #include "SkOpts.h"
14 #include "SkReadBuffer.h" 14 #include "SkReadBuffer.h"
15 #include "SkSpecialImage.h" 15 #include "SkSpecialImage.h"
16 #include "SkWriteBuffer.h" 16 #include "SkWriteBuffer.h"
17 17
18 #if SK_SUPPORT_GPU 18 #if SK_SUPPORT_GPU
19 #include "GrContext.h" 19 #include "GrContext.h"
20 #include "SkGr.h" 20 #include "SkGr.h"
21 #endif 21 #endif
22 22
23 sk_sp<SkImageFilter> SkBlurImageFilter::Make(SkScalar sigmaX, SkScalar sigmaY,
24 sk_sp<SkImageFilter> input,
25 const CropRect* cropRect) {
26 if (0 == sigmaX && 0 == sigmaY && !cropRect) {
27 return input;
28 }
29 return sk_sp<SkImageFilter>(new SkBlurImageFilter(sigmaX, sigmaY, input, cro pRect));
30 }
31
23 // This rather arbitrary-looking value results in a maximum box blur kernel size 32 // This rather arbitrary-looking value results in a maximum box blur kernel size
24 // of 1000 pixels on the raster path, which matches the WebKit and Firefox 33 // of 1000 pixels on the raster path, which matches the WebKit and Firefox
25 // implementations. Since the GPU path does not compute a box blur, putting 34 // implementations. Since the GPU path does not compute a box blur, putting
26 // the limit on sigma ensures consistent behaviour between the GPU and 35 // the limit on sigma ensures consistent behaviour between the GPU and
27 // raster paths. 36 // raster paths.
28 #define MAX_SIGMA SkIntToScalar(532) 37 #define MAX_SIGMA SkIntToScalar(532)
29 38
30 static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) { 39 static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) {
31 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height()); 40 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height());
32 ctm.mapVectors(&sigma, 1); 41 ctm.mapVectors(&sigma, 1);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 str->appendf("SkBlurImageFilter: ("); 251 str->appendf("SkBlurImageFilter: (");
243 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); 252 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight);
244 253
245 if (this->getInput(0)) { 254 if (this->getInput(0)) {
246 this->getInput(0)->toString(str); 255 this->getInput(0)->toString(str);
247 } 256 }
248 257
249 str->append("))"); 258 str->append("))");
250 } 259 }
251 #endif 260 #endif
OLDNEW
« no previous file with comments | « src/core/SkLocalMatrixImageFilter.cpp ('k') | src/effects/SkComposeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698