| 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(fRadius.fWidth) && |
| 28 SkScalarIsFinite(fRadius.fHeight) && |
| 29 (fRadius.fWidth >= 0) && |
| 30 (fRadius.fHeight >= 0)); |
| 27 } | 31 } |
| 28 | 32 |
| 29 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input, const SkIRect* cropRect) | 33 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input, const SkIRect* cropRect) |
| 30 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { | 34 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { |
| 31 } | 35 } |
| 32 | 36 |
| 33 | 37 |
| 34 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 38 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
| 35 this->INHERITED::flatten(buffer); | 39 this->INHERITED::flatten(buffer); |
| 36 buffer.writeInt(fRadius.fWidth); | 40 buffer.writeInt(fRadius.fWidth); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 | 593 |
| 590 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 594 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
| 591 return false; | 595 return false; |
| 592 } | 596 } |
| 593 offset->fX += bounds.left(); | 597 offset->fX += bounds.left(); |
| 594 offset->fY += bounds.top(); | 598 offset->fY += bounds.top(); |
| 595 return true; | 599 return true; |
| 596 } | 600 } |
| 597 | 601 |
| 598 #endif | 602 #endif |
| OLD | NEW |