| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |