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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return fMode && fMode->asFragmentProcessor(NULL, NULL) && !cropRectIsSet(); 126 return fMode && fMode->asFragmentProcessor(NULL, NULL) && !cropRectIsSet();
127 } 127 }
128 128
129 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, 129 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
130 const SkBitmap& src, 130 const SkBitmap& src,
131 const Context& ctx, 131 const Context& ctx,
132 SkBitmap* result, 132 SkBitmap* result,
133 SkIPoint* offset) const { 133 SkIPoint* offset) const {
134 SkBitmap background = src; 134 SkBitmap background = src;
135 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); 135 SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
136 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &backgro und, 136 if (this->getInput(0) &&
137 &backgroundOffset)) { 137 !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &background, &bac kgroundOffset)) {
138 return onFilterImage(proxy, src, ctx, result, offset); 138 return this->onFilterImage(proxy, src, ctx, result, offset);
139 } 139 }
140
140 GrTexture* backgroundTex = background.getTexture(); 141 GrTexture* backgroundTex = background.getTexture();
141
142 if (NULL == backgroundTex) { 142 if (NULL == backgroundTex) {
143 SkASSERT(false); 143 SkASSERT(false);
144 return false; 144 return false;
145 } 145 }
146 146
147 SkBitmap foreground = src; 147 SkBitmap foreground = src;
148 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 148 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
149 if (getInput(1) && !getInput(1)->getInputResultGPU(proxy, src, ctx, &foregro und, 149 if (this->getInput(1) &&
150 &foregroundOffset)) { 150 !this->getInput(1)->getInputResultGPU(proxy, src, ctx, &foreground, &for egroundOffset)) {
151 return onFilterImage(proxy, src, ctx, result, offset); 151 return this->onFilterImage(proxy, src, ctx, result, offset);
152 } 152 }
153 GrTexture* foregroundTex = foreground.getTexture(); 153 GrTexture* foregroundTex = foreground.getTexture();
154 GrContext* context = foregroundTex->getContext(); 154 GrContext* context = foregroundTex->getContext();
155 155
156 GrFragmentProcessor* xferProcessor = NULL; 156 GrFragmentProcessor* xferProcessor = NULL;
157 157
158 GrSurfaceDesc desc; 158 GrSurfaceDesc desc;
159 desc.fFlags = kRenderTarget_GrSurfaceFlag; 159 desc.fFlags = kRenderTarget_GrSurfaceFlag;
160 desc.fWidth = src.width(); 160 desc.fWidth = src.width();
161 desc.fHeight = src.height(); 161 desc.fHeight = src.height();
(...skipping 22 matching lines...) Expand all
184 SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Cr eate( 184 SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Cr eate(
185 foregroundTex, foregroundMatrix, 185 foregroundTex, foregroundMatrix,
186 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()), 186 GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()),
187 GrTextureDomain::kDecal_Mode, 187 GrTextureDomain::kDecal_Mode,
188 GrTextureParams::kNone_FilterMode) 188 GrTextureParams::kNone_FilterMode)
189 ); 189 );
190 190
191 paint.addColorProcessor(foregroundDomain.get()); 191 paint.addColorProcessor(foregroundDomain.get());
192 paint.addColorProcessor(xferProcessor)->unref(); 192 paint.addColorProcessor(xferProcessor)->unref();
193 193
194 GrDrawContext* drawContext = context->drawContext(); 194 GrDrawContext* drawContext = context->drawContext(dst->asRenderTarget());
195 if (!drawContext) { 195 if (!drawContext) {
196 return false; 196 return false;
197 } 197 }
198 drawContext->uses(backgroundTex);
199 drawContext->uses(foregroundTex);
198 200
199 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, 201 drawContext->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint,
200 SkMatrix::I(), srcRect); 202 SkMatrix::I(), srcRect);
201 203
202 offset->fX = backgroundOffset.fX; 204 offset->fX = backgroundOffset.fX;
203 offset->fY = backgroundOffset.fY; 205 offset->fY = backgroundOffset.fY;
204 WrapTexture(dst, src.width(), src.height(), result); 206 WrapTexture(dst, src.width(), src.height(), result);
205 return true; 207 return true;
206 } 208 }
207 209
208 #endif 210 #endif
209 211
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698