Chromium Code Reviews| 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 | 8 |
| 9 #ifndef SkMorphologyImageFilter_DEFINED | 9 #ifndef SkMorphologyImageFilter_DEFINED |
| 10 #define SkMorphologyImageFilter_DEFINED | 10 #define SkMorphologyImageFilter_DEFINED |
| 11 | 11 |
| 12 #include "SkColor.h" | |
| 12 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
| 13 #include "SkSize.h" | 14 #include "SkSize.h" |
| 14 | 15 |
| 16 /** | |
| 17 * All morphology procs have the same signature: src is the source buffer, dst t he | |
| 18 * destination buffer, radius is the morphology radius, width and height are the bounds | |
| 19 * of the destination buffer (in pixels), and srcStride and dstStride are the | |
| 20 * number of pixels per row in each buffer. All buffers are 8888. | |
| 21 */ | |
| 22 | |
| 23 typedef void (*SkMorphologyProc)(const SkPMColor* src, SkPMColor* dst, int radiu s, | |
|
reed1
2014/01/22 21:17:16
Does this definition need to be public, or is it p
Stephen White
2014/01/22 21:36:42
I needed it to reference it from filterImageGeneri
| |
| 24 int width, int height, int srcStride, int dstSt ride); | |
| 25 | |
| 26 enum SkMorphologyProcType { | |
| 27 kDilateX_SkMorphologyProcType, | |
| 28 kDilateY_SkMorphologyProcType, | |
| 29 kErodeX_SkMorphologyProcType, | |
| 30 kErodeY_SkMorphologyProcType | |
| 31 }; | |
| 32 | |
| 15 class SK_API SkMorphologyImageFilter : public SkImageFilter { | 33 class SK_API SkMorphologyImageFilter : public SkImageFilter { |
| 16 public: | 34 public: |
| 17 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, cons t CropRect* cropRect); | 35 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, cons t CropRect* cropRect); |
| 18 | 36 |
| 19 protected: | 37 protected: |
| 38 bool filterImageGeneric(SkMorphologyProc procX, SkMorphologyProc procY, | |
| 39 Proxy*, const SkBitmap& src, const SkMatrix&, | |
| 40 SkBitmap* result, SkIPoint* offset); | |
| 20 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); | 41 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); |
| 21 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 42 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 22 #if SK_SUPPORT_GPU | 43 #if SK_SUPPORT_GPU |
| 23 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 44 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
| 45 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, | |
| 46 const SkMatrix& ctm, SkBitmap* result, | |
| 47 SkIPoint* offset); | |
| 24 #endif | 48 #endif |
| 25 | 49 |
| 26 SkISize radius() const { return fRadius; } | 50 SkISize radius() const { return fRadius; } |
| 27 | 51 |
| 28 private: | 52 private: |
| 29 SkISize fRadius; | 53 SkISize fRadius; |
| 30 typedef SkImageFilter INHERITED; | 54 typedef SkImageFilter INHERITED; |
| 31 }; | 55 }; |
| 32 | 56 |
| 33 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { | 57 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) | 94 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) |
| 71 | 95 |
| 72 protected: | 96 protected: |
| 73 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 97 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
| 74 | 98 |
| 75 private: | 99 private: |
| 76 typedef SkMorphologyImageFilter INHERITED; | 100 typedef SkMorphologyImageFilter INHERITED; |
| 77 }; | 101 }; |
| 78 | 102 |
| 79 #endif | 103 #endif |
| OLD | NEW |