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

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

Issue 522873005: Move MakeDivByTextureWHMatrix to GrCoordTransform (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/gpu/effects/Gr1DKernelEffect.h » ('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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/gpu/effects/Gr1DKernelEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698