| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 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 SkDataTable_DEFINED | 8 #ifndef SkDataTable_DEFINED |
| 9 #define SkDataTable_DEFINED | 9 #define SkDataTable_DEFINED |
| 10 | 10 |
| 11 #include "SkChunkAlloc.h" | 11 #include "SkChunkAlloc.h" |
| 12 #include "SkData.h" | 12 #include "SkData.h" |
| 13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
| 14 #include "SkString.h" | 14 #include "SkString.h" |
| 15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Like SkData, SkDataTable holds an immutable data buffer. The data buffer is | 18 * Like SkData, SkDataTable holds an immutable data buffer. The data buffer is |
| 19 * organized into a table of entries, each with a length, so the entries are | 19 * organized into a table of entries, each with a length, so the entries are |
| 20 * not required to all be the same size. | 20 * not required to all be the same size. |
| 21 */ | 21 */ |
| 22 class SK_API SkDataTable : public SkFlattenable { | 22 class SK_API SkDataTable : public SkFlattenable { |
| 23 typedef SkFlattenable INHERITED; |
| 24 |
| 23 public: | 25 public: |
| 24 SK_DECLARE_INST_COUNT(SkDataTable) | 26 SK_DECLARE_INST_COUNT(SkDataTable) |
| 25 | 27 |
| 26 /** | 28 /** |
| 27 * Returns true if the table is empty (i.e. has no entries). | 29 * Returns true if the table is empty (i.e. has no entries). |
| 28 */ | 30 */ |
| 29 bool isEmpty() const { return 0 == fCount; } | 31 bool isEmpty() const { return 0 == fCount; } |
| 30 | 32 |
| 31 /** | 33 /** |
| 32 * Return the number of entries in the table. 0 for an empty table | 34 * Return the number of entries in the table. 0 for an empty table |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 FreeProc fFreeProc; | 118 FreeProc fFreeProc; |
| 117 void* fFreeProcContext; | 119 void* fFreeProcContext; |
| 118 | 120 |
| 119 SkDataTable(); | 121 SkDataTable(); |
| 120 SkDataTable(const void* array, size_t elemSize, int count, | 122 SkDataTable(const void* array, size_t elemSize, int count, |
| 121 FreeProc, void* context); | 123 FreeProc, void* context); |
| 122 SkDataTable(const Dir*, int count, FreeProc, void* context); | 124 SkDataTable(const Dir*, int count, FreeProc, void* context); |
| 123 virtual ~SkDataTable(); | 125 virtual ~SkDataTable(); |
| 124 | 126 |
| 125 friend class SkDataTableBuilder; // access to Dir | 127 friend class SkDataTableBuilder; // access to Dir |
| 126 | |
| 127 typedef SkFlattenable INHERITED; | |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Helper class that allows for incrementally building up the data needed to | 131 * Helper class that allows for incrementally building up the data needed to |
| 132 * create a SkDataTable. | 132 * create a SkDataTable. |
| 133 */ | 133 */ |
| 134 class SK_API SkDataTableBuilder : SkNoncopyable { | 134 class SK_API SkDataTableBuilder : SkNoncopyable { |
| 135 public: | 135 public: |
| 136 SkDataTableBuilder(size_t minChunkSize); | 136 SkDataTableBuilder(size_t minChunkSize); |
| 137 ~SkDataTableBuilder(); | 137 ~SkDataTableBuilder(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 */ | 175 */ |
| 176 SkDataTable* detachDataTable(); | 176 SkDataTable* detachDataTable(); |
| 177 | 177 |
| 178 private: | 178 private: |
| 179 SkTDArray<SkDataTable::Dir> fDir; | 179 SkTDArray<SkDataTable::Dir> fDir; |
| 180 SkChunkAlloc* fHeap; | 180 SkChunkAlloc* fHeap; |
| 181 size_t fMinChunkSize; | 181 size_t fMinChunkSize; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 #endif | 184 #endif |
| OLD | NEW |