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