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 "effects/Gr1DKernelEffect.h" | 18 #include "effects/Gr1DKernelEffect.h" |
19 #include "SkImageFilterUtils.h" | 19 #include "SkImageFilterUtils.h" |
20 #endif | 20 #endif |
21 | 21 |
22 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
) | 22 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
) |
23 : INHERITED(buffer) { | 23 : INHERITED(buffer) { |
24 fRadius.fWidth = buffer.readInt(); | 24 fRadius.fWidth = buffer.readInt(); |
25 fRadius.fHeight = buffer.readInt(); | 25 fRadius.fHeight = buffer.readInt(); |
26 } | 26 } |
27 | 27 |
28 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input, const SkIRect* cropRect) | 28 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma
geFilter* input, const CropRect* cropRect) |
29 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { | 29 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 33 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
34 this->INHERITED::flatten(buffer); | 34 this->INHERITED::flatten(buffer); |
35 buffer.writeInt(fRadius.fWidth); | 35 buffer.writeInt(fRadius.fWidth); |
36 buffer.writeInt(fRadius.fHeight); | 36 buffer.writeInt(fRadius.fHeight); |
37 } | 37 } |
38 | 38 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { | 582 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy
pe, radius(), result)) { |
583 return false; | 583 return false; |
584 } | 584 } |
585 offset->fX += bounds.left(); | 585 offset->fX += bounds.left(); |
586 offset->fY += bounds.top(); | 586 offset->fY += bounds.top(); |
587 return true; | 587 return true; |
588 } | 588 } |
589 | 589 |
590 #endif | 590 #endif |
OLD | NEW |