| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 SkAutoTUnref<GrTexture> dst(ast.detach()); | 147 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| 148 | 148 |
| 149 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 149 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
| 150 | 150 |
| 151 if (!fMode || !fMode->asNewEffect(&xferEffect, backgroundTex)) { | 151 if (!fMode || !fMode->asNewEffect(&xferEffect, backgroundTex)) { |
| 152 // canFilterImageGPU() should've taken care of this | 152 // canFilterImageGPU() should've taken care of this |
| 153 SkASSERT(false); | 153 SkASSERT(false); |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 | 156 |
| 157 SkMatrix foregroundMatrix = GrEffect::MakeDivByTextureWHMatrix(foregroundTex
); | 157 SkMatrix foregroundMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(foreg
roundTex); |
| 158 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), | 158 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), |
| 159 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); | 159 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); |
| 160 | 160 |
| 161 | 161 |
| 162 SkRect srcRect; | 162 SkRect srcRect; |
| 163 src.getBounds(&srcRect); | 163 src.getBounds(&srcRect); |
| 164 | 164 |
| 165 GrPaint paint; | 165 GrPaint paint; |
| 166 paint.addColorTextureEffect(foregroundTex, foregroundMatrix); | 166 paint.addColorTextureEffect(foregroundTex, foregroundMatrix); |
| 167 paint.addColorEffect(xferEffect)->unref(); | 167 paint.addColorEffect(xferEffect)->unref(); |
| 168 context->drawRect(paint, srcRect); | 168 context->drawRect(paint, srcRect); |
| 169 | 169 |
| 170 offset->fX = backgroundOffset.fX; | 170 offset->fX = backgroundOffset.fX; |
| 171 offset->fY = backgroundOffset.fY; | 171 offset->fY = backgroundOffset.fY; |
| 172 WrapTexture(dst, src.width(), src.height(), result); | 172 WrapTexture(dst, src.width(), src.height(), result); |
| 173 return true; | 173 return true; |
| 174 } | 174 } |
| 175 | 175 |
| 176 #endif | 176 #endif |
| OLD | NEW |