OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 #ifndef C_SALT_IMAGE_INL_H_ | |
6 #define C_SALT_IMAGE_INL_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 namespace c_salt { | |
11 #define INLINE_NO_INSTRUMENT \ | |
12 __attribute__((no_instrument_function, always_inline)) | |
13 | |
14 // build a packed color | |
15 INLINE_NO_INSTRUMENT | |
16 uint32_t MakeARGB(uint8_t r, uint8_t g, uint8_t b, uint8_t a); | |
17 inline uint32_t MakeARGB(uint8_t r, uint8_t g, uint8_t b, uint8_t a) { | |
18 return (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)); | |
19 } | |
20 | |
21 // extract R, G, B, A from packed color | |
22 INLINE_NO_INSTRUMENT int ExtractR(uint32_t c); | |
23 inline int ExtractR(uint32_t c) { | |
24 return (c >> 16) & 0xFF; | |
25 } | |
26 | |
27 INLINE_NO_INSTRUMENT int ExtractG(uint32_t c); | |
28 inline int ExtractG(uint32_t c) { | |
29 return (c >> 8) & 0xFF; | |
30 } | |
31 | |
32 INLINE_NO_INSTRUMENT int ExtractB(uint32_t c); | |
33 inline int ExtractB(uint32_t c) { | |
34 return c & 0xFF; | |
35 } | |
36 | |
37 INLINE_NO_INSTRUMENT int ExtractA(uint32_t c); | |
38 inline int ExtractA(uint32_t c) { | |
39 return (c >> 24) & 0xFF; | |
40 } | |
41 #undef INLINE_NO_INSTRUMENT | |
42 } // namespace c_salt | |
43 | |
44 #endif // C_SALT_IMAGE_INL_H_ | |
OLD | NEW |