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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 this->onFilterImage(proxy, src, ctm, result, offset); | 104 this->onFilterImage(proxy, src, ctm, result, offset); |
105 } | 105 } |
106 | 106 |
107 bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, | 107 bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, |
108 SkIRect* dst) { | 108 SkIRect* dst) { |
109 SkASSERT(&src); | 109 SkASSERT(&src); |
110 SkASSERT(dst); | 110 SkASSERT(dst); |
111 return this->onFilterBounds(src, ctm, dst); | 111 return this->onFilterBounds(src, ctm, dst); |
112 } | 112 } |
113 | 113 |
| 114 void SkImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { |
| 115 if (0 == fInputCount) { |
| 116 *dst = src; |
| 117 return; |
| 118 } |
| 119 if (this->getInput(0)) { |
| 120 this->getInput(0)->computeFastBounds(src, dst); |
| 121 } else { |
| 122 *dst = src; |
| 123 } |
| 124 for (int i = 1; i < fInputCount; i++) { |
| 125 SkImageFilter* input = this->getInput(i); |
| 126 if (input) { |
| 127 SkRect bounds; |
| 128 input->computeFastBounds(src, &bounds); |
| 129 dst->join(bounds); |
| 130 } else { |
| 131 dst->join(src); |
| 132 } |
| 133 } |
| 134 } |
| 135 |
114 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, | 136 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, |
115 SkBitmap*, SkIPoint*) { | 137 SkBitmap*, SkIPoint*) { |
116 return false; | 138 return false; |
117 } | 139 } |
118 | 140 |
119 bool SkImageFilter::canFilterImageGPU() const { | 141 bool SkImageFilter::canFilterImageGPU() const { |
120 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect()); | 142 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect()); |
121 } | 143 } |
122 | 144 |
123 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
trix& ctm, | 145 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
trix& ctm, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return true; | 211 return true; |
190 } | 212 } |
191 | 213 |
192 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons
t SkIRect&) const { | 214 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons
t SkIRect&) const { |
193 return false; | 215 return false; |
194 } | 216 } |
195 | 217 |
196 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 218 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
197 return false; | 219 return false; |
198 } | 220 } |
OLD | NEW |