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

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

Issue 31853003: Remove GrContext from SkXfermode::[Aa]sNewEffectOrCoeff() and all subclasses, (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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/SkArithmeticMode.cpp ('k') | src/gpu/SkGpuDevice.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 "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698