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 #include "SkImageFilterCacheKey.h" | 9 #include "SkImageFilterCacheKey.h" |
10 | 10 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 SkSpecialImage* SkImageFilter::filterInput(int index, | 590 SkSpecialImage* SkImageFilter::filterInput(int index, |
591 SkSpecialImage* src, | 591 SkSpecialImage* src, |
592 const Context& ctx, | 592 const Context& ctx, |
593 SkIPoint* offset) const { | 593 SkIPoint* offset) const { |
594 SkImageFilter* input = this->getInput(index); | 594 SkImageFilter* input = this->getInput(index); |
595 if (!input) { | 595 if (!input) { |
596 return SkRef(src); | 596 return SkRef(src); |
597 } | 597 } |
598 | 598 |
599 return input->filterImage(src, this->mapContext(ctx), offset); | 599 SkAutoTUnref<SkSpecialImage> result(input->filterImage(src, this->mapContext
(ctx), offset)); |
| 600 |
| 601 #if SK_SUPPORT_GPU |
| 602 if (src->peekTexture() && result && !result->peekTexture()) { |
| 603 // Keep the result on the GPU - this is still required for some |
| 604 // image filters that don't support GPU in all cases |
| 605 GrContext* context = src->peekTexture()->getContext(); |
| 606 return result->makeTextureImage(src->internal_getProxy(), context).relea
se(); |
| 607 } |
| 608 #endif |
| 609 |
| 610 return result.release(); |
600 } | 611 } |
601 | 612 |
602 #if SK_SUPPORT_GPU | 613 #if SK_SUPPORT_GPU |
603 | 614 |
604 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr
oxy, | 615 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr
oxy, |
605 const SkBitmap& src, const Context&
ctx, | 616 const SkBitmap& src, const Context&
ctx, |
606 SkBitmap* result, SkIPoint* offset)
const { | 617 SkBitmap* result, SkIPoint* offset)
const { |
607 SkImageFilter* input = this->getInput(index); | 618 SkImageFilter* input = this->getInput(index); |
608 if (!input) { | 619 if (!input) { |
609 return true; | 620 return true; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 822 } |
812 return dev; | 823 return dev; |
813 } | 824 } |
814 | 825 |
815 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, | 826 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, |
816 const SkImageFilter::Context& ctx, | 827 const SkImageFilter::Context& ctx, |
817 SkBitmap* result, SkIPoint* offset) { | 828 SkBitmap* result, SkIPoint* offset) { |
818 return fDevice->filterImage(filter, src, ctx, result, offset); | 829 return fDevice->filterImage(filter, src, ctx, result, offset); |
819 } | 830 } |
820 | 831 |
OLD | NEW |