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 "SkXfermodeImageFilter.h" | 8 #include "SkXfermodeImageFilter.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 &paint); | 71 &paint); |
72 offset->fX += backgroundOffset.fX; | 72 offset->fX += backgroundOffset.fX; |
73 offset->fY += backgroundOffset.fY; | 73 offset->fY += backgroundOffset.fY; |
74 return true; | 74 return true; |
75 } | 75 } |
76 | 76 |
77 #if SK_SUPPORT_GPU | 77 #if SK_SUPPORT_GPU |
78 | 78 |
79 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, | 79 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, |
80 const SkBitmap& src, | 80 const SkBitmap& src, |
| 81 const SkMatrix& ctm, |
81 SkBitmap* result, | 82 SkBitmap* result, |
82 SkIPoint* offset) { | 83 SkIPoint* offset) { |
83 SkBitmap background; | 84 SkBitmap background; |
84 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); | 85 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); |
85 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, &backgro
und, | 86 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &ba
ckground, |
86 &backgroundOffset)) { | 87 &backgroundOffset)) { |
87 return false; | 88 return false; |
88 } | 89 } |
89 GrTexture* backgroundTex = background.getTexture(); | 90 GrTexture* backgroundTex = background.getTexture(); |
90 SkBitmap foreground; | 91 SkBitmap foreground; |
91 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 92 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
92 if (!SkImageFilterUtils::GetInputResultGPU(getInput(1), proxy, src, &foregro
und, | 93 if (!SkImageFilterUtils::GetInputResultGPU(getInput(1), proxy, src, ctm, &fo
reground, |
93 &foregroundOffset)) { | 94 &foregroundOffset)) { |
94 return false; | 95 return false; |
95 } | 96 } |
96 GrTexture* foregroundTex = foreground.getTexture(); | 97 GrTexture* foregroundTex = foreground.getTexture(); |
97 GrContext* context = foregroundTex->getContext(); | 98 GrContext* context = foregroundTex->getContext(); |
98 | 99 |
99 GrEffectRef* xferEffect = NULL; | 100 GrEffectRef* xferEffect = NULL; |
100 | 101 |
101 GrTextureDesc desc; | 102 GrTextureDesc desc; |
102 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 103 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); | 137 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); |
137 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); | 138 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); |
138 context->drawRect(foregroundPaint, srcRect); | 139 context->drawRect(foregroundPaint, srcRect); |
139 } | 140 } |
140 offset->fX += backgroundOffset.fX; | 141 offset->fX += backgroundOffset.fX; |
141 offset->fY += backgroundOffset.fY; | 142 offset->fY += backgroundOffset.fY; |
142 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); | 143 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); |
143 } | 144 } |
144 | 145 |
145 #endif | 146 #endif |
OLD | NEW |