OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 buffer.writeInt(fInputCount); | 62 buffer.writeInt(fInputCount); |
63 for (int i = 0; i < fInputCount; i++) { | 63 for (int i = 0; i < fInputCount; i++) { |
64 SkImageFilter* input = getInput(i); | 64 SkImageFilter* input = getInput(i); |
65 buffer.writeBool(input != NULL); | 65 buffer.writeBool(input != NULL); |
66 if (input != NULL) { | 66 if (input != NULL) { |
67 buffer.writeFlattenable(input); | 67 buffer.writeFlattenable(input); |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 SkBitmap SkImageFilter::getInputResult(int index, Proxy* proxy, | |
73 const SkBitmap& src, const SkMatrix& ctm, | |
74 SkIPoint* loc) { | |
75 SkASSERT(index < fInputCount); | |
76 SkImageFilter* input = getInput(index); | |
77 SkBitmap result; | |
78 if (input && input->filterImage(proxy, src, ctm, &result, loc)) { | |
79 return result; | |
80 } else { | |
81 return src; | |
82 } | |
83 } | |
84 | |
85 | |
86 bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, | 72 bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, |
87 const SkMatrix& ctm, | 73 const SkMatrix& ctm, |
88 SkBitmap* result, SkIPoint* loc) { | 74 SkBitmap* result, SkIPoint* loc) { |
89 SkASSERT(result); | 75 SkASSERT(result); |
90 SkASSERT(loc); | 76 SkASSERT(loc); |
91 /* | 77 /* |
92 * Give the proxy first shot at the filter. If it returns false, ask | 78 * Give the proxy first shot at the filter. If it returns false, ask |
93 * the filter to do it. | 79 * the filter to do it. |
94 */ | 80 */ |
95 return (proxy && proxy->filterImage(this, src, ctm, result, loc)) || | 81 return (proxy && proxy->filterImage(this, src, ctm, result, loc)) || |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return true; | 142 return true; |
157 } | 143 } |
158 | 144 |
159 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*) const { | 145 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*) const { |
160 return false; | 146 return false; |
161 } | 147 } |
162 | 148 |
163 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 149 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
164 return false; | 150 return false; |
165 } | 151 } |
OLD | NEW |