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