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 "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 SkMatrix foregroundMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(foreg
roundTex); | 180 SkMatrix foregroundMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(foreg
roundTex); |
181 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), | 181 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), |
182 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); | 182 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); |
183 | 183 |
184 | 184 |
185 SkRect srcRect; | 185 SkRect srcRect; |
186 src.getBounds(&srcRect); | 186 src.getBounds(&srcRect); |
187 | 187 |
188 SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Cr
eate( | 188 SkAutoTUnref<const GrFragmentProcessor> foregroundDomain(GrTextureDomainEffe
ct::Create( |
189 foregroundTex, foregroundMatrix, | 189 foregroundTex, foregroundMatrix, |
190 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()), | 190 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()), |
191 GrTextureDomain::kDecal_Mode, | 191 GrTextureDomain::kDecal_Mode, |
192 GrTextureParams::kNone_FilterMode) | 192 GrTextureParams::kNone_FilterMode) |
193 ); | 193 ); |
194 | 194 |
195 paint.addColorFragmentProcessor(foregroundDomain.get()); | 195 paint.addColorFragmentProcessor(foregroundDomain.get()); |
196 if (xferFP) { | 196 if (xferFP) { |
197 paint.addColorFragmentProcessor(xferFP)->unref(); | 197 paint.addColorFragmentProcessor(xferFP)->unref(); |
198 } | 198 } |
199 | 199 |
200 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); | 200 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); |
201 if (!drawContext) { | 201 if (!drawContext) { |
202 return false; | 202 return false; |
203 } | 203 } |
204 | 204 |
205 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, | 205 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, |
206 SkMatrix::I(), srcRect); | 206 SkMatrix::I(), srcRect); |
207 | 207 |
208 offset->fX = backgroundOffset.fX; | 208 offset->fX = backgroundOffset.fX; |
209 offset->fY = backgroundOffset.fY; | 209 offset->fY = backgroundOffset.fY; |
210 WrapTexture(dst, src.width(), src.height(), result); | 210 WrapTexture(dst, src.width(), src.height(), result); |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
214 #endif | 214 #endif |
215 | 215 |
OLD | NEW |