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...) 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 * Checks if alpha types are premul and unpremul | |
69 * | |
70 */ | |
71 static inline bool premul_and_unpremul(SkAlphaType dst, SkAlphaType src) { | |
72 return kPremul_SkAlphaType == dst && kUnpremul_SkAlphaType == src; | |
73 } | |
74 | |
75 /* | |
76 * | |
77 * Get a byte from a buffer | 68 * Get a byte from a buffer |
78 * This method is unsafe, the caller is responsible for performing a check | 69 * This method is unsafe, the caller is responsible for performing a check |
79 * | 70 * |
80 */ | 71 */ |
81 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { | 72 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { |
82 return buffer[i]; | 73 return buffer[i]; |
83 } | 74 } |
84 | 75 |
85 /* | 76 /* |
86 * | 77 * |
(...skipping 21 matching lines...) Loading... |
108 uint32_t result; | 99 uint32_t result; |
109 memcpy(&result, &(buffer[i]), 4); | 100 memcpy(&result, &(buffer[i]), 4); |
110 #ifdef SK_CPU_BENDIAN | 101 #ifdef SK_CPU_BENDIAN |
111 return SkEndianSwap32(result); | 102 return SkEndianSwap32(result); |
112 #else | 103 #else |
113 return result; | 104 return result; |
114 #endif | 105 #endif |
115 } | 106 } |
116 | 107 |
117 #endif // SkCodecPriv_DEFINED | 108 #endif // SkCodecPriv_DEFINED |
OLD | NEW |