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

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

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup 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
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t { 536 void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
537 // This is valid because the color components of the result of the kernel al l come 537 // This is valid because the color components of the result of the kernel al l come
538 // exactly from existing values in the source texture. 538 // exactly from existing values in the source texture.
539 this->updateInvariantOutputForModulation(inout); 539 this->updateInvariantOutputForModulation(inout);
540 } 540 }
541 541
542 /////////////////////////////////////////////////////////////////////////////// 542 ///////////////////////////////////////////////////////////////////////////////
543 543
544 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); 544 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect);
545 545
546 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random, 546 GrFragmentProcessor* GrMorphologyEffect::TestCreate(GrProcessorTestData* d) {
547 GrContext*, 547 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
548 const GrCaps&,
549 GrTexture* textures[]) {
550 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
551 GrProcessorUnitTest::kAlphaTextureIdx; 548 GrProcessorUnitTest::kAlphaTextureIdx;
552 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; 549 Direction dir = d->fRandom->nextBool() ? kX_Direction : kY_Direction;
553 static const int kMaxRadius = 10; 550 static const int kMaxRadius = 10;
554 int radius = random->nextRangeU(1, kMaxRadius); 551 int radius = d->fRandom->nextRangeU(1, kMaxRadius);
555 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho logyType : 552 MorphologyType type = d->fRandom->nextBool() ? GrMorphologyEffect::kErode_Mo rphologyType :
556 GrMorphologyEffect::kDilate_Morph ologyType; 553 GrMorphologyEffect::kDilate_Morph ologyType;
557 554
558 return GrMorphologyEffect::Create(textures[texIdx], dir, radius, type); 555 return GrMorphologyEffect::Create(d->fTextures[texIdx], dir, radius, type);
559 } 556 }
560 557
561 namespace { 558 namespace {
562 559
563 560
564 void apply_morphology_rect(GrDrawContext* drawContext, 561 void apply_morphology_rect(GrDrawContext* drawContext,
565 GrRenderTarget* rt, 562 GrRenderTarget* rt,
566 const GrClip& clip, 563 const GrClip& clip,
567 GrTexture* texture, 564 GrTexture* texture,
568 const SkIRect& srcRect, 565 const SkIRect& srcRect,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 SkBitmap* result, SkIPoint* offset) con st { 752 SkBitmap* result, SkIPoint* offset) con st {
756 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 753 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
757 } 754 }
758 755
759 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 756 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
760 SkBitmap* result, SkIPoint* offset) cons t { 757 SkBitmap* result, SkIPoint* offset) cons t {
761 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 758 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
762 } 759 }
763 760
764 #endif 761 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698