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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // exactly from existing values in the source texture. | 416 // exactly from existing values in the source texture. |
417 this->updateConstantColorComponentsForModulation(color, validFlags); | 417 this->updateConstantColorComponentsForModulation(color, validFlags); |
418 } | 418 } |
419 | 419 |
420 /////////////////////////////////////////////////////////////////////////////// | 420 /////////////////////////////////////////////////////////////////////////////// |
421 | 421 |
422 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); | 422 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); |
423 | 423 |
424 GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random, | 424 GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random, |
425 GrContext*, | 425 GrContext*, |
| 426 const GrDrawTargetCaps&, |
426 GrTexture* textures[]) { | 427 GrTexture* textures[]) { |
427 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 428 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
428 GrEffectUnitTest::kAlphaTextureIdx; | 429 GrEffectUnitTest::kAlphaTextureIdx; |
429 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; | 430 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; |
430 static const int kMaxRadius = 10; | 431 static const int kMaxRadius = 10; |
431 int radius = random->nextRangeU(1, kMaxRadius); | 432 int radius = random->nextRangeU(1, kMaxRadius); |
432 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho
logyType : | 433 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho
logyType : |
433 GrMorphologyEffect::kDilate_Morph
ologyType; | 434 GrMorphologyEffect::kDilate_Morph
ologyType; |
434 | 435 |
435 return GrMorphologyEffect::Create(textures[texIdx], dir, radius, type); | 436 return GrMorphologyEffect::Create(textures[texIdx], dir, radius, type); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 515 } |
515 GrTexture* input = (GrTexture*) inputBM.getTexture(); | 516 GrTexture* input = (GrTexture*) inputBM.getTexture(); |
516 SkIRect bounds; | 517 SkIRect bounds; |
517 src.getBounds(&bounds); | 518 src.getBounds(&bounds); |
518 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 519 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
519 GrMorphologyEffect::kErode_MorphologyType, radius())); | 520 GrMorphologyEffect::kErode_MorphologyType, radius())); |
520 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 521 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
521 } | 522 } |
522 | 523 |
523 #endif | 524 #endif |
OLD | NEW |