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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b
ackgroundTex)) { | 95 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b
ackgroundTex)) { |
96 return false; | 96 return false; |
97 } | 97 } |
98 | 98 |
99 GrPaint paint; | 99 GrPaint paint; |
100 SkRect srcRect; | 100 SkRect srcRect; |
101 src.getBounds(&srcRect); | 101 src.getBounds(&srcRect); |
102 if (NULL != xferEffect) { | 102 if (NULL != xferEffect) { |
103 paint.colorStage(0)->setEffect( | 103 paint.colorStage(0)->setEffect( |
104 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText
ureWHMatrix(foregroundTex)))->unref(); | 104 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText
ureWHMatrix(foregroundTex)))->unref(); |
105 paint.colorStage(1)->setEffect(xferEffect); | 105 paint.colorStage(1)->setEffect(xferEffect)->unref(); |
106 context->drawRect(paint, srcRect); | 106 context->drawRect(paint, srcRect); |
107 } else { | 107 } else { |
108 paint.colorStage(0)->setEffect( | 108 paint.colorStage(0)->setEffect( |
109 GrSimpleTextureEffect::Create(backgroundTex, GrEffect::MakeDivByText
ureWHMatrix(backgroundTex)))->unref(); | 109 GrSimpleTextureEffect::Create(backgroundTex, GrEffect::MakeDivByText
ureWHMatrix(backgroundTex)))->unref(); |
110 context->drawRect(paint, srcRect); | 110 context->drawRect(paint, srcRect); |
111 paint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); | 111 paint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); |
112 paint.colorStage(0)->setEffect( | 112 paint.colorStage(0)->setEffect( |
113 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText
ureWHMatrix(foregroundTex)))->unref(); | 113 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText
ureWHMatrix(foregroundTex)))->unref(); |
114 context->drawRect(paint, srcRect); | 114 context->drawRect(paint, srcRect); |
115 } | 115 } |
116 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); | 116 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); |
117 } | 117 } |
118 | 118 |
119 #endif | 119 #endif |
OLD | NEW |