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

Side by Side Diff: src/effects/SkDisplacementMapEffect.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/SkBlurMaskFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkUnPreMultiply.h" 10 #include "SkUnPreMultiply.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 desc.fWidth = src.width(); 298 desc.fWidth = src.width();
299 desc.fHeight = src.height(); 299 desc.fHeight = src.height();
300 desc.fConfig = kSkia8888_GrPixelConfig; 300 desc.fConfig = kSkia8888_GrPixelConfig;
301 301
302 GrAutoScratchTexture ast(context, desc); 302 GrAutoScratchTexture ast(context, desc);
303 SkAutoTUnref<GrTexture> dst(ast.detach()); 303 SkAutoTUnref<GrTexture> dst(ast.detach());
304 304
305 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); 305 GrContext::AutoRenderTarget art(context, dst->asRenderTarget());
306 306
307 GrPaint paint; 307 GrPaint paint;
308 paint.colorStage(0)->setEffect( 308 paint.addColorEffect(
309 GrDisplacementMapEffect::Create(fXChannelSelector, 309 GrDisplacementMapEffect::Create(fXChannelSelector,
310 fYChannelSelector, 310 fYChannelSelector,
311 fScale, 311 fScale,
312 displacement, 312 displacement,
313 color))->unref(); 313 color))->unref();
314 SkRect srcRect; 314 SkRect srcRect;
315 src.getBounds(&srcRect); 315 src.getBounds(&srcRect);
316 SkRect dstRect = srcRect; 316 SkRect dstRect = srcRect;
317 dstRect.offset(SkIntToScalar(colorOffset.fX), SkIntToScalar(colorOffset.fY)) ; 317 dstRect.offset(SkIntToScalar(colorOffset.fX), SkIntToScalar(colorOffset.fY)) ;
318 context->drawRectToRect(paint, srcRect, dstRect); 318 context->drawRectToRect(paint, srcRect, dstRect);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 colorTex); 532 colorTex);
533 533
534 colorKey <<= GrGLEffectMatrix::kKeyBits; 534 colorKey <<= GrGLEffectMatrix::kKeyBits;
535 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix ::kKeyBits); 535 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix ::kKeyBits);
536 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix ::kKeyBits + 536 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix ::kKeyBits +
537 SkDisplacementMapEff ect::kKeyBits); 537 SkDisplacementMapEff ect::kKeyBits);
538 538
539 return xKey | yKey | displKey | colorKey; 539 return xKey | yKey | displKey | colorKey;
540 } 540 }
541 #endif 541 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698