Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 SkTableMaskFilter_DEFINED | 8 #ifndef SkTableMaskFilter_DEFINED |
| 9 #define SkTableMaskFilter_DEFINED | 9 #define SkTableMaskFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkMaskFilter.h" | 11 #include "SkMaskFilter.h" |
| 12 #include "SkScalar.h" | 12 #include "SkScalar.h" |
| 13 | 13 |
| 14 /** \class SkTableMaskFilter | 14 /** \class SkTableMaskFilter |
| 15 | 15 |
| 16 Applies a table lookup on each of the alpha values in the mask. | 16 Applies a table lookup on each of the alpha values in the mask. |
| 17 Helper methods create some common tables (e.g. gamma, clipping) | 17 Helper methods create some common tables (e.g. gamma, clipping) |
| 18 */ | 18 */ |
| 19 class SK_API SkTableMaskFilter : public SkMaskFilter { | 19 class SK_API SkTableMaskFilter : public SkMaskFilter { |
| 20 public: | 20 public: |
| 21 SkTableMaskFilter(); | |
| 22 SkTableMaskFilter(const uint8_t table[256]); | |
| 23 virtual ~SkTableMaskFilter(); | 21 virtual ~SkTableMaskFilter(); |
| 24 | 22 |
| 25 /** Utility that sets the gamma table | 23 /** Utility that sets the gamma table |
| 26 */ | 24 */ |
| 27 static void MakeGammaTable(uint8_t table[256], SkScalar gamma); | 25 static void MakeGammaTable(uint8_t table[256], SkScalar gamma); |
| 28 | 26 |
| 29 /** Utility that creates a clipping table: clamps values below min to 0 | 27 /** Utility that creates a clipping table: clamps values below min to 0 |
| 30 and above max to 255, and rescales the remaining into 0..255 | 28 and above max to 255, and rescales the remaining into 0..255 |
| 31 */ | 29 */ |
| 32 static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max); | 30 static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 47 virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&, | 45 virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&, |
| 48 SkIPoint*) const SK_OVERRIDE; | 46 SkIPoint*) const SK_OVERRIDE; |
| 49 | 47 |
| 50 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) | 48 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) |
| 51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilter) | 49 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilter) |
| 52 | 50 |
| 53 protected: | 51 protected: |
| 54 SkTableMaskFilter(SkReadBuffer& rb); | 52 SkTableMaskFilter(SkReadBuffer& rb); |
| 55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 53 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 56 | 54 |
| 55 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | |
| 56 public: | |
| 57 #endif | |
| 58 SkTableMaskFilter(); | |
| 59 SkTableMaskFilter(const uint8_t table[256]); | |
|
scroggo
2014/02/20 14:17:07
Please add a factory for this constructor, which i
Dominik Grewe
2014/02/20 16:38:11
Good spot, thanks. I just assumed everyone only us
| |
| 60 | |
| 57 private: | 61 private: |
| 58 uint8_t fTable[256]; | 62 uint8_t fTable[256]; |
| 59 | 63 |
| 60 typedef SkMaskFilter INHERITED; | 64 typedef SkMaskFilter INHERITED; |
| 61 }; | 65 }; |
| 62 | 66 |
| 63 #endif | 67 #endif |
| OLD | NEW |