Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 18686007: Make GrPaint have a variable sized array of color and coverage stages rather than a fixed size. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rob's comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 SkXfermode::Coeff sm, dm; 112 SkXfermode::Coeff sm, dm;
113 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b ackgroundTex)) { 113 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b ackgroundTex)) {
114 return false; 114 return false;
115 } 115 }
116 116
117 SkMatrix foregroundMatrix = GrEffect::MakeDivByTextureWHMatrix(foregroundTex ); 117 SkMatrix foregroundMatrix = GrEffect::MakeDivByTextureWHMatrix(foregroundTex );
118 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf fset.fX), 118 foregroundMatrix.preTranslate(SkIntToScalar(backgroundOffset.fX-foregroundOf fset.fX),
119 SkIntToScalar(backgroundOffset.fY-foregroundOf fset.fY)); 119 SkIntToScalar(backgroundOffset.fY-foregroundOf fset.fY));
120 120
121 121
122 GrPaint paint;
123 SkRect srcRect; 122 SkRect srcRect;
124 src.getBounds(&srcRect); 123 src.getBounds(&srcRect);
125 if (NULL != xferEffect) { 124 if (NULL != xferEffect) {
126 paint.colorStage(0)->setEffect( 125 GrPaint paint;
127 GrSimpleTextureEffect::Create(foregroundTex, foregroundMatrix))->unr ef(); 126 paint.addColorTextureEffect(foregroundTex, foregroundMatrix);
128 paint.colorStage(1)->setEffect(xferEffect)->unref(); 127 paint.addColorEffect(xferEffect)->unref();
129 context->drawRect(paint, srcRect); 128 context->drawRect(paint, srcRect);
130 } else { 129 } else {
130 GrPaint backgroundPaint;
131 SkMatrix backgroundMatrix = GrEffect::MakeDivByTextureWHMatrix(backgroun dTex); 131 SkMatrix backgroundMatrix = GrEffect::MakeDivByTextureWHMatrix(backgroun dTex);
132 paint.colorStage(0)->setEffect( 132 backgroundPaint.addColorTextureEffect(backgroundTex, backgroundMatrix);
133 GrSimpleTextureEffect::Create(backgroundTex, backgroundMatrix))->unr ef(); 133 context->drawRect(backgroundPaint, srcRect);
134 context->drawRect(paint, srcRect); 134
135 paint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); 135 GrPaint foregroundPaint;
136 paint.colorStage(0)->setEffect( 136 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen d(dm));
137 GrSimpleTextureEffect::Create(foregroundTex, foregroundMatrix))->unr ef(); 137 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix);
138 context->drawRect(paint, srcRect); 138 context->drawRect(foregroundPaint, srcRect);
139 } 139 }
140 offset->fX += backgroundOffset.fX; 140 offset->fX += backgroundOffset.fX;
141 offset->fY += backgroundOffset.fY; 141 offset->fY += backgroundOffset.fY;
142 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t); 142 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t);
143 } 143 }
144 144
145 #endif 145 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698