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

Side by Side Diff: include/effects/SkBlurImageFilter.h

Issue 1518643002: SkBlurImageFilter returns input when sigma = 0 (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: safe refcnt Created 5 years 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
« bench/BlurImageFilterBench.cpp ('K') | « gm/imagefilters.cpp ('k') | 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 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 #ifndef SkBlurImageFilter_DEFINED 8 #ifndef SkBlurImageFilter_DEFINED
9 #define SkBlurImageFilter_DEFINED 9 #define SkBlurImageFilter_DEFINED
10 10
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 #include "SkSize.h" 12 #include "SkSize.h"
13 13
14 class SK_API SkBlurImageFilter : public SkImageFilter { 14 class SK_API SkBlurImageFilter : public SkImageFilter {
15 public: 15 public:
16 static SkImageFilter* Create(SkScalar sigmaX, SkScalar sigmaY, SkImageFilter * input = NULL, 16 static SkImageFilter* Create(SkScalar sigmaX, SkScalar sigmaY, SkImageFilter * input = NULL,
17 const CropRect* cropRect = NULL) { 17 const CropRect* cropRect = NULL) {
18 if (0 == sigmaX && 0 == sigmaY && nullptr == cropRect) {
19 SkSafeRef(input);
20 return input;
reed1 2015/12/10 19:41:17 or return SkSafeRef(input);
21 }
18 return new SkBlurImageFilter(sigmaX, sigmaY, input, cropRect); 22 return new SkBlurImageFilter(sigmaX, sigmaY, input, cropRect);
19 } 23 }
20 24
21 void computeFastBounds(const SkRect&, SkRect*) const override; 25 void computeFastBounds(const SkRect&, SkRect*) const override;
22 26
23 SK_TO_STRING_OVERRIDE() 27 SK_TO_STRING_OVERRIDE()
24 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter) 28 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
25 29
26 protected: 30 protected:
27 void flatten(SkWriteBuffer&) const override; 31 void flatten(SkWriteBuffer&) const override;
28 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* re sult, 32 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* re sult,
29 SkIPoint* offset) const override; 33 SkIPoint* offset) const override;
30 void onFilterNodeBounds(const SkIRect& src, const SkMatrix&, 34 void onFilterNodeBounds(const SkIRect& src, const SkMatrix&,
31 SkIRect* dst, MapDirection) const override; 35 SkIRect* dst, MapDirection) const override;
32 bool canFilterImageGPU() const override { return true; } 36 bool canFilterImageGPU() const override { return true; }
33 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, S kBitmap* result, 37 bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, S kBitmap* result,
34 SkIPoint* offset) const override; 38 SkIPoint* offset) const override;
35 39
36 private: 40 private:
37 SkBlurImageFilter(SkScalar sigmaX, 41 SkBlurImageFilter(SkScalar sigmaX,
38 SkScalar sigmaY, 42 SkScalar sigmaY,
39 SkImageFilter* input, 43 SkImageFilter* input,
40 const CropRect* cropRect); 44 const CropRect* cropRect);
41 45
42 SkSize fSigma; 46 SkSize fSigma;
43 typedef SkImageFilter INHERITED; 47 typedef SkImageFilter INHERITED;
44 }; 48 };
45 49
46 #endif 50 #endif
OLDNEW
« bench/BlurImageFilterBench.cpp ('K') | « gm/imagefilters.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698