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 "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" |
12 #include "SkRect.h" | 13 #include "SkRect.h" |
13 #include "SkMorphology_opts.h" | 14 #include "SkMorphology_opts.h" |
14 #if SK_SUPPORT_GPU | 15 #if SK_SUPPORT_GPU |
15 #include "GrContext.h" | 16 #include "GrContext.h" |
16 #include "GrTexture.h" | 17 #include "GrTexture.h" |
17 #include "GrTBackendEffectFactory.h" | 18 #include "GrTBackendEffectFactory.h" |
18 #include "gl/GrGLEffect.h" | 19 #include "gl/GrGLEffect.h" |
19 #include "effects/Gr1DKernelEffect.h" | 20 #include "effects/Gr1DKernelEffect.h" |
20 #include "SkImageFilterUtils.h" | 21 #include "SkImageFilterUtils.h" |
21 #endif | 22 #endif |
22 | 23 |
23 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer
) | 24 SkMorphologyImageFilter::SkMorphologyImageFilter(SkReadBuffer& buffer) |
24 : INHERITED(1, buffer) { | 25 : INHERITED(1, buffer) { |
25 fRadius.fWidth = buffer.readInt(); | 26 fRadius.fWidth = buffer.readInt(); |
26 fRadius.fHeight = buffer.readInt(); | 27 fRadius.fHeight = buffer.readInt(); |
27 buffer.validate((fRadius.fWidth >= 0) && | 28 buffer.validate((fRadius.fWidth >= 0) && |
28 (fRadius.fHeight >= 0)); | 29 (fRadius.fHeight >= 0)); |
29 } | 30 } |
30 | 31 |
31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 32 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
32 int radiusY, | 33 int radiusY, |
33 SkImageFilter* input, | 34 SkImageFilter* input, |
34 const CropRect* cropRect) | 35 const CropRect* cropRect) |
35 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { | 36 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { |
36 } | 37 } |
37 | 38 |
38 | 39 |
39 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 40 void SkMorphologyImageFilter::flatten(SkWriteBuffer& buffer) const { |
40 this->INHERITED::flatten(buffer); | 41 this->INHERITED::flatten(buffer); |
41 buffer.writeInt(fRadius.fWidth); | 42 buffer.writeInt(fRadius.fWidth); |
42 buffer.writeInt(fRadius.fHeight); | 43 buffer.writeInt(fRadius.fHeight); |
43 } | 44 } |
44 | 45 |
45 enum MorphDirection { | 46 enum MorphDirection { |
46 kX, kY | 47 kX, kY |
47 }; | 48 }; |
48 | 49 |
49 template<MorphDirection direction> | 50 template<MorphDirection direction> |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 SkBitmap* result, SkIPoint* offset) { | 571 SkBitmap* result, SkIPoint* offset) { |
571 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); | 572 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); |
572 } | 573 } |
573 | 574 |
574 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, | 575 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
575 SkBitmap* result, SkIPoint* offset) { | 576 SkBitmap* result, SkIPoint* offset) { |
576 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); | 577 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); |
577 } | 578 } |
578 | 579 |
579 #endif | 580 #endif |
OLD | NEW |