]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/converter.def
correction for Fit() which didn't handle properly windows positioned at (-1, -1)
[wxWidgets.git] / utils / wxMMedia2 / lib / converter.def
1 #define DEFINE_CONV(name, input_type, output_type, convert) \
2 static void Convert_##name##(const void *buf_in, void *buf_out, wxUint32 len) \
3 {\
4 register input_type src; \
5 register const input_type *t_buf_in = (input_type *)buf_in; \
6 register output_type *t_buf_out = (output_type *)buf_out; \
7 \
8 while (len > 0) { \
9 src = *t_buf_in++; \
10 *t_buf_out++ = convert; \
11 len -= sizeof(input_type); \
12 } \
13 }
14
15 // TODO: define converters for all other formats (32, 24)
16
17 DEFINE_CONV(8_8_sign, wxUint8, wxUint8, (src ^ 0x80))
18
19 DEFINE_CONV(8_16, wxUint8, wxUint16, (((wxUint16)src) << 8))
20 DEFINE_CONV(8_16_swap, wxUint8, wxUint16, (src))
21 DEFINE_CONV(8_16_sign, wxUint8, wxUint16, (((wxUint16)(src ^ 0x80)) << 8))
22 DEFINE_CONV(8_16_sign_swap, wxUint8, wxUint16, (src ^ 0x80))
23
24 DEFINE_CONV(16_8, wxUint16, wxUint8, (wxUint8)(src >> 8))
25 DEFINE_CONV(16_8_sign, wxUint16, wxUint8, (wxUint8)((src >> 8) ^ 0x80))
26 DEFINE_CONV(16_swap_8, wxUint16, wxUint8, (wxUint8)(src & 0xff))
27 DEFINE_CONV(16_swap_8_sign, wxUint16, wxUint8, (wxUint8)((src & 0xff) ^ 0x80))
28
29 //DEFINE_CONV(24_8, wxUint32, wxUint8, (wxUint8)(src >> 16))
30 //DEFINE_CONV(24_8_sig, wxUint32, wxUint8, (wxUint8)((src >> 16) ^ 0x80))
31
32 //DEFINE_CONV(32_8, wxUint32, wxUint8, (wxUint8)(src >> 24))
33
34 DEFINE_CONV(16_sign, wxUint16, wxUint16, (src ^ 0x8000))
35 DEFINE_CONV(16_swap, wxUint16, wxUint16, (((src & 0xff) << 8) | ((src >> 8) & 0xff)))
36 // Problem.
37 DEFINE_CONV(16_swap_16_sign, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x80))
38 // DEFINE_CONV(16_sign_16_swap, wxUint16, wxUint16, ((((src & 0xff) << 8) | ((src >> 8) & 0xff)) ^ 0x8000))
39 DEFINE_CONV(16_swap_16_sign_swap, wxUint16, wxUint16, (src ^ 0x80))