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