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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (input != NULL) { | 87 if (input != NULL) { |
88 buffer.writeFlattenable(input); | 88 buffer.writeFlattenable(input); |
89 } | 89 } |
90 } | 90 } |
91 buffer.writeRect(fCropRect.rect()); | 91 buffer.writeRect(fCropRect.rect()); |
92 buffer.writeUInt(fCropRect.flags()); | 92 buffer.writeUInt(fCropRect.flags()); |
93 } | 93 } |
94 | 94 |
95 bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, | 95 bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, |
96 const SkMatrix& ctm, | 96 const SkMatrix& ctm, |
97 SkBitmap* result, SkIPoint* offset) { | 97 SkBitmap* result, SkIPoint* offset) const { |
98 SkASSERT(result); | 98 SkASSERT(result); |
99 SkASSERT(offset); | 99 SkASSERT(offset); |
100 /* | 100 /* |
101 * Give the proxy first shot at the filter. If it returns false, ask | 101 * Give the proxy first shot at the filter. If it returns false, ask |
102 * the filter to do it. | 102 * the filter to do it. |
103 */ | 103 */ |
104 return (proxy && proxy->filterImage(this, src, ctm, result, offset)) || | 104 return (proxy && proxy->filterImage(this, src, ctm, result, offset)) || |
105 this->onFilterImage(proxy, src, ctm, result, offset); | 105 this->onFilterImage(proxy, src, ctm, result, offset); |
106 } | 106 } |
107 | 107 |
(...skipping 20 matching lines...) Expand all Loading... |
128 SkRect bounds; | 128 SkRect bounds; |
129 input->computeFastBounds(src, &bounds); | 129 input->computeFastBounds(src, &bounds); |
130 dst->join(bounds); | 130 dst->join(bounds); |
131 } else { | 131 } else { |
132 dst->join(src); | 132 dst->join(src); |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, | 137 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, |
138 SkBitmap*, SkIPoint*) { | 138 SkBitmap*, SkIPoint*) const { |
139 return false; | 139 return false; |
140 } | 140 } |
141 | 141 |
142 bool SkImageFilter::canFilterImageGPU() const { | 142 bool SkImageFilter::canFilterImageGPU() const { |
143 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect()); | 143 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect()); |
144 } | 144 } |
145 | 145 |
146 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
trix& ctm, | 146 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
trix& ctm, |
147 SkBitmap* result, SkIPoint* offset) { | 147 SkBitmap* result, SkIPoint* offset) const { |
148 #if SK_SUPPORT_GPU | 148 #if SK_SUPPORT_GPU |
149 SkBitmap input; | 149 SkBitmap input; |
150 SkASSERT(fInputCount == 1); | 150 SkASSERT(fInputCount == 1); |
151 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 151 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
152 if (!SkImageFilterUtils::GetInputResultGPU(this->getInput(0), proxy, src, ct
m, &input, &srcOffset)) { | 152 if (!SkImageFilterUtils::GetInputResultGPU(this->getInput(0), proxy, src, ct
m, &input, &srcOffset)) { |
153 return false; | 153 return false; |
154 } | 154 } |
155 GrTexture* srcTexture = input.getTexture(); | 155 GrTexture* srcTexture = input.getTexture(); |
156 SkIRect bounds; | 156 SkIRect bounds; |
157 src.getBounds(&bounds); | 157 src.getBounds(&bounds); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return true; | 235 return true; |
236 } | 236 } |
237 | 237 |
238 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons
t SkIRect&) const { | 238 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons
t SkIRect&) const { |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 242 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
243 return false; | 243 return false; |
244 } | 244 } |
OLD | NEW |