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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 switch (kern.direction()) { | 427 switch (kern.direction()) { |
428 case Gr1DKernelEffect::kX_Direction: | 428 case Gr1DKernelEffect::kX_Direction: |
429 imageIncrement[0] = 1.0f / texture.width(); | 429 imageIncrement[0] = 1.0f / texture.width(); |
430 break; | 430 break; |
431 case Gr1DKernelEffect::kY_Direction: | 431 case Gr1DKernelEffect::kY_Direction: |
432 imageIncrement[1] = 1.0f / texture.height(); | 432 imageIncrement[1] = 1.0f / texture.height(); |
433 break; | 433 break; |
434 default: | 434 default: |
435 GrCrash("Unknown filter direction."); | 435 GrCrash("Unknown filter direction."); |
436 } | 436 } |
437 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); | 437 uman.set2fv(fImageIncrementUni, 1, imageIncrement); |
438 } | 438 } |
439 | 439 |
440 /////////////////////////////////////////////////////////////////////////////// | 440 /////////////////////////////////////////////////////////////////////////////// |
441 | 441 |
442 GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, | 442 GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, |
443 Direction direction, | 443 Direction direction, |
444 int radius, | 444 int radius, |
445 MorphologyType type) | 445 MorphologyType type) |
446 : Gr1DKernelEffect(texture, direction, radius) | 446 : Gr1DKernelEffect(texture, direction, radius) |
447 , fType(type) { | 447 , fType(type) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 614 |
615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
616 return false; | 616 return false; |
617 } | 617 } |
618 offset->fX += bounds.left(); | 618 offset->fX += bounds.left(); |
619 offset->fY += bounds.top(); | 619 offset->fY += bounds.top(); |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 #endif | 623 #endif |
OLD | NEW |