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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 m.coordsType(), | 370 m.coordsType(), |
371 m.texture(0)); | 371 m.texture(0)); |
372 return key | matrixKey; | 372 return key | matrixKey; |
373 } | 373 } |
374 | 374 |
375 void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, | 375 void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, |
376 const GrDrawEffect& drawEffect) { | 376 const GrDrawEffect& drawEffect) { |
377 const Gr1DKernelEffect& kern = drawEffect.castEffect<Gr1DKernelEffect>(); | 377 const Gr1DKernelEffect& kern = drawEffect.castEffect<Gr1DKernelEffect>(); |
378 GrTexture& texture = *kern.texture(0); | 378 GrTexture& texture = *kern.texture(0); |
379 // the code we generated was for a specific kernel radius | 379 // the code we generated was for a specific kernel radius |
380 GrAssert(kern.radius() == fRadius); | 380 SkASSERT(kern.radius() == fRadius); |
381 float imageIncrement[2] = { 0 }; | 381 float imageIncrement[2] = { 0 }; |
382 switch (kern.direction()) { | 382 switch (kern.direction()) { |
383 case Gr1DKernelEffect::kX_Direction: | 383 case Gr1DKernelEffect::kX_Direction: |
384 imageIncrement[0] = 1.0f / texture.width(); | 384 imageIncrement[0] = 1.0f / texture.width(); |
385 break; | 385 break; |
386 case Gr1DKernelEffect::kY_Direction: | 386 case Gr1DKernelEffect::kY_Direction: |
387 imageIncrement[1] = 1.0f / texture.height(); | 387 imageIncrement[1] = 1.0f / texture.height(); |
388 break; | 388 break; |
389 default: | 389 default: |
390 GrCrash("Unknown filter direction."); | 390 GrCrash("Unknown filter direction."); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 GrTexture* input = inputBM.getTexture(); | 525 GrTexture* input = inputBM.getTexture(); |
526 SkIRect bounds; | 526 SkIRect bounds; |
527 src.getBounds(&bounds); | 527 src.getBounds(&bounds); |
528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 528 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
529 GrMorphologyEffect::kErode_MorphologyType, radius())); | 529 GrMorphologyEffect::kErode_MorphologyType, radius())); |
530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 530 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
531 } | 531 } |
532 | 532 |
533 #endif | 533 #endif |
OLD | NEW |