| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 desc.fWidth = src.width(); | 116 desc.fWidth = src.width(); |
| 117 desc.fHeight = src.height(); | 117 desc.fHeight = src.height(); |
| 118 desc.fConfig = kSkia8888_GrPixelConfig; | 118 desc.fConfig = kSkia8888_GrPixelConfig; |
| 119 | 119 |
| 120 GrAutoScratchTexture ast(context, desc); | 120 GrAutoScratchTexture ast(context, desc); |
| 121 SkAutoTUnref<GrTexture> dst(ast.detach()); | 121 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| 122 | 122 |
| 123 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 123 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
| 124 | 124 |
| 125 SkXfermode::Coeff sm, dm; | 125 SkXfermode::Coeff sm, dm; |
| 126 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b
ackgroundTex)) { | 126 if (!SkXfermode::AsNewEffectOrCoeff(fMode, &xferEffect, &sm, &dm, background
Tex)) { |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 | 129 |
| 130 SkMatrix foregroundMatrix = GrEffect::MakeDivByTextureWHMatrix(foregroundTex
); | 130 SkMatrix foregroundMatrix = GrEffect::MakeDivByTextureWHMatrix(foregroundTex
); |
| 131 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), | 131 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf
fset.fX), |
| 132 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); | 132 SkIntToScalar(backgroundOffset.fY-foregroundOf
fset.fY)); |
| 133 | 133 |
| 134 | 134 |
| 135 SkRect srcRect; | 135 SkRect srcRect; |
| 136 src.getBounds(&srcRect); | 136 src.getBounds(&srcRect); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 149 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); | 149 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); |
| 150 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); | 150 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); |
| 151 context->drawRect(foregroundPaint, srcRect); | 151 context->drawRect(foregroundPaint, srcRect); |
| 152 } | 152 } |
| 153 offset->fX += backgroundOffset.fX; | 153 offset->fX += backgroundOffset.fX; |
| 154 offset->fY += backgroundOffset.fY; | 154 offset->fY += backgroundOffset.fY; |
| 155 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); | 155 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); |
| 156 } | 156 } |
| 157 | 157 |
| 158 #endif | 158 #endif |
| OLD | NEW |