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 SkAutoTUnref<SkSpecialImage> result(input->filterImage(src, this->mapContext
(ctx), offset)); | 599 return input->filterImage(src, this->mapContext(ctx), offset); |
600 | |
601 #if SK_SUPPORT_GPU | |
602 if (src->peekTexture() && !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(); | |
611 } | 600 } |
612 | 601 |
613 #if SK_SUPPORT_GPU | 602 #if SK_SUPPORT_GPU |
614 | 603 |
615 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr
oxy, | 604 bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr
oxy, |
616 const SkBitmap& src, const Context&
ctx, | 605 const SkBitmap& src, const Context&
ctx, |
617 SkBitmap* result, SkIPoint* offset)
const { | 606 SkBitmap* result, SkIPoint* offset)
const { |
618 SkImageFilter* input = this->getInput(index); | 607 SkImageFilter* input = this->getInput(index); |
619 if (!input) { | 608 if (!input) { |
620 return true; | 609 return true; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 811 } |
823 return dev; | 812 return dev; |
824 } | 813 } |
825 | 814 |
826 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, | 815 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, |
827 const SkImageFilter::Context& ctx, | 816 const SkImageFilter::Context& ctx, |
828 SkBitmap* result, SkIPoint* offset) { | 817 SkBitmap* result, SkIPoint* offset) { |
829 return fDevice->filterImage(filter, src, ctx, result, offset); | 818 return fDevice->filterImage(filter, src, ctx, result, offset); |
830 } | 819 } |
831 | 820 |
OLD | NEW |