OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The Android Open Source Project | 2 * Copyright 2015 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 SkCodecPriv_DEFINED | 8 #ifndef SkCodecPriv_DEFINED |
9 #define SkCodecPriv_DEFINED | 9 #define SkCodecPriv_DEFINED |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return compute_row_bytes_ppb(width, pixelsPerByte); | 58 return compute_row_bytes_ppb(width, pixelsPerByte); |
59 } else { | 59 } else { |
60 SkASSERT(0 == bitsPerPixel % 8); | 60 SkASSERT(0 == bitsPerPixel % 8); |
61 const uint32_t bytesPerPixel = bitsPerPixel / 8; | 61 const uint32_t bytesPerPixel = bitsPerPixel / 8; |
62 return compute_row_bytes_bpp(width, bytesPerPixel); | 62 return compute_row_bytes_bpp(width, bytesPerPixel); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 /* | 66 /* |
67 * | 67 * |
| 68 * Get a pointer to the color table to be used by the decoder |
| 69 * |
| 70 */ |
| 71 static inline SkPMColor* get_color_table_ptr(SkColorType dstColorType, |
| 72 SkPMColor* inputColorPtr, |
| 73 int* inputColorCount, |
| 74 SkPMColor* alternateColorPtr) { |
| 75 if (kIndex_8_SkColorType == dstColorType) { |
| 76 SkASSERT(NULL != inputColorPtr); |
| 77 SkASSERT(NULL != inputColorCount); |
| 78 SkASSERT(256 == *inputColorCount); |
| 79 return inputColorPtr; |
| 80 } else { |
| 81 return alternateColorPtr; |
| 82 } |
| 83 } |
| 84 |
| 85 /* |
| 86 * |
68 * Get a byte from a buffer | 87 * Get a byte from a buffer |
69 * This method is unsafe, the caller is responsible for performing a check | 88 * This method is unsafe, the caller is responsible for performing a check |
70 * | 89 * |
71 */ | 90 */ |
72 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { | 91 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { |
73 return buffer[i]; | 92 return buffer[i]; |
74 } | 93 } |
75 | 94 |
76 /* | 95 /* |
77 * | 96 * |
(...skipping 27 matching lines...) Expand all Loading... |
105 #endif | 124 #endif |
106 } | 125 } |
107 | 126 |
108 #ifdef SK_PRINT_CODEC_MESSAGES | 127 #ifdef SK_PRINT_CODEC_MESSAGES |
109 #define SkCodecPrintf SkDebugf | 128 #define SkCodecPrintf SkDebugf |
110 #else | 129 #else |
111 #define SkCodecPrintf(...) | 130 #define SkCodecPrintf(...) |
112 #endif | 131 #endif |
113 | 132 |
114 #endif // SkCodecPriv_DEFINED | 133 #endif // SkCodecPriv_DEFINED |
OLD | NEW |