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

Side by Side Diff: src/effects/SkMorphologyImageFilter.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/SkDisplacementMapEffect.cpp ('k') | src/effects/SkXfermodeImageFilter.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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 namespace { 446 namespace {
447 447
448 void apply_morphology_pass(GrContext* context, 448 void apply_morphology_pass(GrContext* context,
449 GrTexture* texture, 449 GrTexture* texture,
450 const SkIRect& rect, 450 const SkIRect& rect,
451 int radius, 451 int radius,
452 GrMorphologyEffect::MorphologyType morphType, 452 GrMorphologyEffect::MorphologyType morphType,
453 Gr1DKernelEffect::Direction direction) { 453 Gr1DKernelEffect::Direction direction) {
454 GrPaint paint; 454 GrPaint paint;
455 paint.colorStage(0)->setEffect(GrMorphologyEffect::Create(texture, 455 paint.addColorEffect(GrMorphologyEffect::Create(texture,
456 direction, 456 direction,
457 radius, 457 radius,
458 morphType))->unref (); 458 morphType))->unref();
459 context->drawRect(paint, SkRect::MakeFromIRect(rect)); 459 context->drawRect(paint, SkRect::MakeFromIRect(rect));
460 } 460 }
461 461
462 GrTexture* apply_morphology(GrTexture* srcTexture, 462 GrTexture* apply_morphology(GrTexture* srcTexture,
463 const SkIRect& rect, 463 const SkIRect& rect,
464 GrMorphologyEffect::MorphologyType morphType, 464 GrMorphologyEffect::MorphologyType morphType,
465 SkISize radius) { 465 SkISize radius) {
466 GrContext* context = srcTexture->getContext(); 466 GrContext* context = srcTexture->getContext();
467 srcTexture->ref(); 467 srcTexture->ref();
468 468
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 524 }
525 GrTexture* input = inputBM.getTexture(); 525 GrTexture* input = inputBM.getTexture();
526 SkIRect bounds; 526 SkIRect bounds;
527 src.getBounds(&bounds); 527 src.getBounds(&bounds);
528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, 528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds,
529 GrMorphologyEffect::kErode_MorphologyType, radius())); 529 GrMorphologyEffect::kErode_MorphologyType, radius()));
530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(), result); 530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(), result);
531 } 531 }
532 532
533 #endif 533 #endif
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698