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 10 matching lines...) Expand all Loading... |
21 uint8_t zeroAlpha = 0; \ | 21 uint8_t zeroAlpha = 0; \ |
22 uint8_t maxAlpha = 0xFF; | 22 uint8_t maxAlpha = 0xFF; |
23 | 23 |
24 #define UPDATE_RESULT_ALPHA(alpha) \ | 24 #define UPDATE_RESULT_ALPHA(alpha) \ |
25 zeroAlpha |= (alpha); \ | 25 zeroAlpha |= (alpha); \ |
26 maxAlpha &= (alpha); | 26 maxAlpha &= (alpha); |
27 | 27 |
28 #define COMPUTE_RESULT_ALPHA \ | 28 #define COMPUTE_RESULT_ALPHA \ |
29 SkSwizzler::GetResult(zeroAlpha, maxAlpha); | 29 SkSwizzler::GetResult(zeroAlpha, maxAlpha); |
30 | 30 |
| 31 // Number of bytes checked to see if an image is a png |
| 32 #define PNG_BYTES_TO_CHECK 4 |
| 33 |
31 /* | 34 /* |
32 * | 35 * |
33 * Compute row bytes for an image using pixels per byte | 36 * Compute row bytes for an image using pixels per byte |
34 * | 37 * |
35 */ | 38 */ |
36 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { | 39 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { |
37 return (width + pixelsPerByte - 1) / pixelsPerByte; | 40 return (width + pixelsPerByte - 1) / pixelsPerByte; |
38 } | 41 } |
39 | 42 |
40 /* | 43 /* |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 uint32_t result; | 102 uint32_t result; |
100 memcpy(&result, &(buffer[i]), 4); | 103 memcpy(&result, &(buffer[i]), 4); |
101 #ifdef SK_CPU_BENDIAN | 104 #ifdef SK_CPU_BENDIAN |
102 return SkEndianSwap32(result); | 105 return SkEndianSwap32(result); |
103 #else | 106 #else |
104 return result; | 107 return result; |
105 #endif | 108 #endif |
106 } | 109 } |
107 | 110 |
108 #endif // SkCodecPriv_DEFINED | 111 #endif // SkCodecPriv_DEFINED |
OLD | NEW |