OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 #ifndef SkKernel33MaskFilter_DEFINED | 8 #ifndef SkKernel33MaskFilter_DEFINED |
9 #define SkKernel33MaskFilter_DEFINED | 9 #define SkKernel33MaskFilter_DEFINED |
10 | 10 |
11 #include "SkMaskFilter.h" | 11 #include "SkMaskFilter.h" |
12 | 12 |
13 class SK_API SkKernel33ProcMaskFilter : public SkMaskFilter { | 13 class SK_API SkKernel33ProcMaskFilter : public SkMaskFilter { |
14 public: | 14 public: |
15 virtual uint8_t computeValue(uint8_t* const* srcRows) const = 0; | 15 virtual uint8_t computeValue(uint8_t* const* srcRows) const = 0; |
16 | 16 |
17 virtual SkMask::Format getFormat() const SK_OVERRIDE; | 17 virtual SkMask::Format getFormat() const SK_OVERRIDE; |
18 virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&, | 18 virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&, |
19 SkIPoint*) const SK_OVERRIDE; | 19 SkIPoint*) const SK_OVERRIDE; |
20 | 20 |
21 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) | 21 SK_TO_STRING_OVERRIDE() |
22 | 22 |
23 protected: | 23 protected: |
24 SkKernel33ProcMaskFilter(unsigned percent256 = 256) | 24 SkKernel33ProcMaskFilter(unsigned percent256 = 256) |
25 : fPercent256(percent256) {} | 25 : fPercent256(percent256) {} |
26 SkKernel33ProcMaskFilter(SkReadBuffer& rb); | 26 SkKernel33ProcMaskFilter(SkReadBuffer& rb); |
27 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 27 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
28 | 28 |
29 private: | 29 private: |
30 int fPercent256; | 30 int fPercent256; |
31 | 31 |
32 typedef SkMaskFilter INHERITED; | 32 typedef SkMaskFilter INHERITED; |
33 }; | 33 }; |
34 | 34 |
35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
36 | 36 |
37 class SK_API SkKernel33MaskFilter : public SkKernel33ProcMaskFilter { | 37 class SK_API SkKernel33MaskFilter : public SkKernel33ProcMaskFilter { |
38 public: | 38 public: |
39 static SkKernel33MaskFilter* Create(const int coeff[3][3], int shift, int pe
rcent256 = 256) { | 39 static SkKernel33MaskFilter* Create(const int coeff[3][3], int shift, int pe
rcent256 = 256) { |
40 return SkNEW_ARGS(SkKernel33MaskFilter, (coeff, shift, percent256)); | 40 return SkNEW_ARGS(SkKernel33MaskFilter, (coeff, shift, percent256)); |
41 } | 41 } |
42 | 42 |
43 // override from SkKernel33ProcMaskFilter | 43 // override from SkKernel33ProcMaskFilter |
44 virtual uint8_t computeValue(uint8_t* const* srcRows) const SK_OVERRIDE; | 44 virtual uint8_t computeValue(uint8_t* const* srcRows) const SK_OVERRIDE; |
45 | 45 |
46 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) | 46 SK_TO_STRING_OVERRIDE() |
47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter) | 47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter) |
48 | 48 |
49 protected: | 49 protected: |
50 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | 50 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
51 public: | 51 public: |
52 #endif | 52 #endif |
53 SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256) | 53 SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256) |
54 : SkKernel33ProcMaskFilter(percent256) { | 54 : SkKernel33ProcMaskFilter(percent256) { |
55 memcpy(fKernel, coeff, 9 * sizeof(int)); | 55 memcpy(fKernel, coeff, 9 * sizeof(int)); |
56 fShift = shift; | 56 fShift = shift; |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 int fKernel[3][3]; | 60 int fKernel[3][3]; |
61 int fShift; | 61 int fShift; |
62 | 62 |
63 SkKernel33MaskFilter(SkReadBuffer& rb); | 63 SkKernel33MaskFilter(SkReadBuffer& rb); |
64 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 64 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
65 | 65 |
66 typedef SkKernel33ProcMaskFilter INHERITED; | 66 typedef SkKernel33ProcMaskFilter INHERITED; |
67 }; | 67 }; |
68 | 68 |
69 #endif | 69 #endif |
OLD | NEW |