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

Side by Side Diff: src/effects/SkBlendImageFilter.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/SkBicubicImageFilter.cpp ('k') | src/effects/SkBlurMaskFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkBlendImageFilter.h" 8 #include "SkBlendImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 desc.fWidth = src.width(); 187 desc.fWidth = src.width();
188 desc.fHeight = src.height(); 188 desc.fHeight = src.height();
189 desc.fConfig = kSkia8888_GrPixelConfig; 189 desc.fConfig = kSkia8888_GrPixelConfig;
190 190
191 GrAutoScratchTexture ast(context, desc); 191 GrAutoScratchTexture ast(context, desc);
192 SkAutoTUnref<GrTexture> dst(ast.detach()); 192 SkAutoTUnref<GrTexture> dst(ast.detach());
193 193
194 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); 194 GrContext::AutoRenderTarget art(context, dst->asRenderTarget());
195 195
196 GrPaint paint; 196 GrPaint paint;
197 paint.colorStage(0)->setEffect( 197 paint.addColorEffect(GrBlendEffect::Create(fMode,
198 GrBlendEffect::Create(fMode, foreground, foregroundOffset, background, b ackgroundOffset))->unref(); 198 foreground, foregroundOffset,
199 background, backgroundOffset))->u nref();
199 SkRect srcRect; 200 SkRect srcRect;
200 src.getBounds(&srcRect); 201 src.getBounds(&srcRect);
201 context->drawRect(paint, srcRect); 202 context->drawRect(paint, srcRect);
202 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t); 203 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t);
203 } 204 }
204 205
205 /////////////////////////////////////////////////////////////////////////////// 206 ///////////////////////////////////////////////////////////////////////////////
206 207
207 GrBlendEffect::GrBlendEffect(SkBlendImageFilter::Mode mode, 208 GrBlendEffect::GrBlendEffect(SkBlendImageFilter::Mode mode,
208 GrTexture* foreground, 209 GrTexture* foreground,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri x(bgTex), 340 EffectKey bgKey = GrGLEffectMatrix::GenKey(GrEffect::MakeDivByTextureWHMatri x(bgTex),
340 drawEffect, 341 drawEffect,
341 kCoordsType, 342 kCoordsType,
342 bgTex); 343 bgTex);
343 bgKey <<= GrGLEffectMatrix::kKeyBits; 344 bgKey <<= GrGLEffectMatrix::kKeyBits;
344 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits); 345 EffectKey modeKey = blend.mode() << (2 * GrGLEffectMatrix::kKeyBits);
345 346
346 return modeKey | bgKey | fgKey; 347 return modeKey | bgKey | fgKey;
347 } 348 }
348 #endif 349 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBicubicImageFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698