| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkColorTable_DEFINED | 10 #ifndef SkColorTable_DEFINED |
| 11 #define SkColorTable_DEFINED | 11 #define SkColorTable_DEFINED |
| 12 | 12 |
| 13 #include "SkColor.h" | 13 #include "SkColor.h" |
| 14 #include "SkFlattenable.h" | 14 #include "SkFlattenable.h" |
| 15 #include "SkImageInfo.h" | 15 #include "SkImageInfo.h" |
| 16 #include "SkLazyPtr.h" | 16 #include "SkLazyPtr.h" |
| 17 | 17 |
| 18 /** \class SkColorTable | 18 /** \class SkColorTable |
| 19 | 19 |
| 20 SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by | 20 SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by |
| 21 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the co
lortable. | 21 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the co
lortable. |
| 22 | 22 |
| 23 SkColorTable is thread-safe. | 23 SkColorTable is thread-safe. |
| 24 */ | 24 */ |
| 25 class SK_API SkColorTable : public SkRefCnt { | 25 class SK_API SkColorTable : public SkRefCnt { |
| 26 public: | 26 public: |
| 27 SK_DECLARE_INST_COUNT(SkColorTable) | 27 SK_DECLARE_INST_COUNT(SkColorTable) |
| 28 | 28 |
| 29 /** Copy up to 256 colors into a new SkColorTable. |
| 30 */ |
| 29 SkColorTable(const SkPMColor colors[], int count); | 31 SkColorTable(const SkPMColor colors[], int count); |
| 30 virtual ~SkColorTable(); | 32 virtual ~SkColorTable(); |
| 31 | 33 |
| 32 /** Returns the number of colors in the table. | 34 /** Returns the number of colors in the table. |
| 33 */ | 35 */ |
| 34 int count() const { return fCount; } | 36 int count() const { return fCount; } |
| 35 | 37 |
| 36 /** Returns the specified color from the table. In the debug build, this ass
erts that | 38 /** Returns the specified color from the table. In the debug build, this ass
erts that |
| 37 * the index is in range (0 <= index < count). | 39 * the index is in range (0 <= index < count). |
| 38 */ | 40 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 58 SkPMColor* fColors; | 60 SkPMColor* fColors; |
| 59 SkLazyPtr<uint16_t, Free16BitCache> f16BitCache; | 61 SkLazyPtr<uint16_t, Free16BitCache> f16BitCache; |
| 60 int fCount; | 62 int fCount; |
| 61 | 63 |
| 62 void init(const SkPMColor* colors, int count); | 64 void init(const SkPMColor* colors, int count); |
| 63 | 65 |
| 64 typedef SkRefCnt INHERITED; | 66 typedef SkRefCnt INHERITED; |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 #endif | 69 #endif |
| OLD | NEW |