| 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" |
| 11 #include "SkFlattenableBuffers.h" | 11 #include "SkFlattenableBuffers.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
| 14 #include "GrContext.h" | 14 #include "GrContext.h" |
| 15 #include "GrTexture.h" | 15 #include "GrTexture.h" |
| 16 #include "GrTBackendEffectFactory.h" | 16 #include "GrTBackendEffectFactory.h" |
| 17 #include "gl/GrGLEffect.h" | 17 #include "gl/GrGLEffect.h" |
| 18 #include "gl/GrGLEffectMatrix.h" | 18 #include "gl/GrGLEffectMatrix.h" |
| 19 #include "effects/Gr1DKernelEffect.h" | 19 #include "effects/Gr1DKernelEffect.h" |
| 20 #include "SkImageFilterUtils.h" | 20 #include "SkImageFilterUtils.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
) | 23 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
) |
| 24 : INHERITED(buffer) { | 24 : INHERITED(buffer) { |
| 25 fRadius.fWidth = buffer.readInt(); | 25 fRadius.fWidth = buffer.readInt(); |
| 26 fRadius.fHeight = buffer.readInt(); | 26 fRadius.fHeight = buffer.readInt(); |
| 27 buffer.validate(SkScalarIsFinite(SkIntToScalar(fRadius.fWidth)) && | 27 buffer.validate((fRadius.fWidth >= 0) && |
| 28 SkScalarIsFinite(SkIntToScalar(fRadius.fHeight)) && | |
| 29 (fRadius.fWidth >= 0) && | |
| 30 (fRadius.fHeight >= 0)); | 28 (fRadius.fHeight >= 0)); |
| 31 } | 29 } |
| 32 | 30 |
| 33 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input) | 31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input) |
| 34 : INHERITED(input), fRadius(SkISize::Make(radiusX, radiusY)) { | 32 : INHERITED(input), fRadius(SkISize::Make(radiusX, radiusY)) { |
| 35 } | 33 } |
| 36 | 34 |
| 37 | 35 |
| 38 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 36 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
| 39 this->INHERITED::flatten(buffer); | 37 this->INHERITED::flatten(buffer); |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 } | 525 } |
| 528 GrTexture* input = inputBM.getTexture(); | 526 GrTexture* input = inputBM.getTexture(); |
| 529 SkIRect bounds; | 527 SkIRect bounds; |
| 530 src.getBounds(&bounds); | 528 src.getBounds(&bounds); |
| 531 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, | 529 SkAutoTUnref<GrTexture> resultTex(apply_morphology(input, bounds, |
| 532 GrMorphologyEffect::kErode_MorphologyType, radius())); | 530 GrMorphologyEffect::kErode_MorphologyType, radius())); |
| 533 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); | 531 return SkImageFilterUtils::WrapTexture(resultTex, src.width(), src.height(),
result); |
| 534 } | 532 } |
| 535 | 533 |
| 536 #endif | 534 #endif |
| OLD | NEW |