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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
lidFlags) const { | 420 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
lidFlags) const { |
421 // This is valid because the color components of the result of the kernel al
l come | 421 // This is valid because the color components of the result of the kernel al
l come |
422 // exactly from existing values in the source texture. | 422 // exactly from existing values in the source texture. |
423 this->updateConstantColorComponentsForModulation(color, validFlags); | 423 this->updateConstantColorComponentsForModulation(color, validFlags); |
424 } | 424 } |
425 | 425 |
426 /////////////////////////////////////////////////////////////////////////////// | 426 /////////////////////////////////////////////////////////////////////////////// |
427 | 427 |
428 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); | 428 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); |
429 | 429 |
430 GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random, | 430 GrEffectRef* GrMorphologyEffect::TestCreate(SkRandom* random, |
431 GrContext*, | 431 GrContext*, |
432 const GrDrawTargetCaps&, | 432 const GrDrawTargetCaps&, |
433 GrTexture* textures[]) { | 433 GrTexture* textures[]) { |
434 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 434 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
435 GrEffectUnitTest::kAlphaTextureIdx; | 435 GrEffectUnitTest::kAlphaTextureIdx; |
436 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; | 436 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; |
437 static const int kMaxRadius = 10; | 437 static const int kMaxRadius = 10; |
438 int radius = random->nextRangeU(1, kMaxRadius); | 438 int radius = random->nextRangeU(1, kMaxRadius); |
439 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho
logyType : | 439 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho
logyType : |
440 GrMorphologyEffect::kDilate_Morph
ologyType; | 440 GrMorphologyEffect::kDilate_Morph
ologyType; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 523 } |
524 GrTexture* input = inputBM.getTexture(); | 524 GrTexture* input = inputBM.getTexture(); |
525 SkIRect bounds; | 525 SkIRect bounds; |
526 src.getBounds(&bounds); | 526 src.getBounds(&bounds); |
527 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 527 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
528 GrMorphologyEffect::kErode_MorphologyType, radius())); | 528 GrMorphologyEffect::kErode_MorphologyType, radius())); |
529 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 529 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
530 } | 530 } |
531 | 531 |
532 #endif | 532 #endif |
OLD | NEW |