OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter:
:Proxy* proxy, | 23 bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter:
:Proxy* proxy, |
24 const SkBitmap& src, SkBitmap* result
, | 24 const SkBitmap& src, SkBitmap* result
, |
25 SkIPoint* offset) { | 25 SkIPoint* offset) { |
26 if (!filter) { | 26 if (!filter) { |
27 *result = src; | 27 *result = src; |
28 return true; | 28 return true; |
29 } else if (filter->canFilterImageGPU()) { | 29 } else if (filter->canFilterImageGPU()) { |
30 return filter->filterImageGPU(proxy, src, result, offset); | 30 return filter->filterImageGPU(proxy, src, result, offset); |
31 } else { | 31 } else { |
32 if (filter->filterImage(proxy, src, SkMatrix(), result, offset)) { | 32 SkMatrix matrix; |
| 33 matrix.reset(); |
| 34 if (filter->filterImage(proxy, src, matrix, result, offset)) { |
33 if (!result->getTexture()) { | 35 if (!result->getTexture()) { |
34 GrContext* context = ((GrTexture *) src.getTexture())->getContex
t(); | 36 GrContext* context = ((GrTexture *) src.getTexture())->getContex
t(); |
35 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, | 37 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, |
36 *result, NULL); | 38 *result, NULL); |
37 result->setPixelRef(new SkGrPixelRef(resultTex))->unref(); | 39 result->setPixelRef(new SkGrPixelRef(resultTex))->unref(); |
38 GrUnlockAndUnrefCachedBitmapTexture(resultTex); | 40 GrUnlockAndUnrefCachedBitmapTexture(resultTex); |
39 } | 41 } |
40 return true; | 42 return true; |
41 } else { | 43 } else { |
42 return false; | 44 return false; |
43 } | 45 } |
44 } | 46 } |
45 } | 47 } |
46 #endif | 48 #endif |
OLD | NEW |