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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (input) { | 277 if (input) { |
278 SkRect bounds; | 278 SkRect bounds; |
279 input->computeFastBounds(src, &bounds); | 279 input->computeFastBounds(src, &bounds); |
280 dst->join(bounds); | 280 dst->join(bounds); |
281 } else { | 281 } else { |
282 dst->join(src); | 282 dst->join(src); |
283 } | 283 } |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
| 287 bool SkImageFilter::canComputeFastBounds() const { |
| 288 if (this->affectsTransparentBlack()) { |
| 289 return false; |
| 290 } |
| 291 for (int i = 0; i < fInputCount; i++) { |
| 292 SkImageFilter* input = this->getInput(i); |
| 293 if (input && !input->canComputeFastBounds()) { |
| 294 return false; |
| 295 } |
| 296 } |
| 297 return true; |
| 298 } |
| 299 |
| 300 bool SkImageFilter::affectsTransparentBlack() const { |
| 301 return false; |
| 302 } |
| 303 |
287 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const Context&, | 304 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const Context&, |
288 SkBitmap*, SkIPoint*) const { | 305 SkBitmap*, SkIPoint*) const { |
289 return false; | 306 return false; |
290 } | 307 } |
291 | 308 |
292 bool SkImageFilter::canFilterImageGPU() const { | 309 bool SkImageFilter::canFilterImageGPU() const { |
293 return this->asFragmentProcessor(NULL, NULL, NULL, SkMatrix::I(), SkIRect())
; | 310 return this->asFragmentProcessor(NULL, NULL, NULL, SkMatrix::I(), SkIRect())
; |
294 } | 311 } |
295 | 312 |
296 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
ext& ctx, | 313 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
ext& ctx, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 595 } |
579 return dev; | 596 return dev; |
580 } | 597 } |
581 | 598 |
582 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, | 599 bool SkImageFilter::Proxy::filterImage(const SkImageFilter* filter, const SkBitm
ap& src, |
583 const SkImageFilter::Context& ctx, | 600 const SkImageFilter::Context& ctx, |
584 SkBitmap* result, SkIPoint* offset) { | 601 SkBitmap* result, SkIPoint* offset) { |
585 return fDevice->filterImage(filter, src, ctx, result, offset); | 602 return fDevice->filterImage(filter, src, ctx, result, offset); |
586 } | 603 } |
587 | 604 |
OLD | NEW |