| 1 | #include "mmxnow_private.h" |
| 2 | |
| 3 | static void rgb16_to_rgb24(STDCONV_PARAMS) |
| 4 | { |
| 5 | |
| 6 | col* dest; |
| 7 | const uint16_t* src; |
| 8 | uint16_t sh; |
| 9 | int i; |
| 10 | dest=(col*)to+width*height-1; |
| 11 | |
| 12 | if(!flip_dir) |
| 13 | src=(const uint16_t*)from+width*height-1; |
| 14 | else |
| 15 | src=(const uint16_t*)from+width-1; |
| 16 | |
| 17 | for(i = height-1; i>=0; i--) |
| 18 | { |
| 19 | int j; |
| 20 | for(j = width - 1; j >= 0; j--) |
| 21 | { |
| 22 | sh = *src; |
| 23 | dest->r=(sh & 0xF800) >> 8; |
| 24 | dest->g=(sh & 0x7E0) >> 3; |
| 25 | dest->b=(sh & 0x1F) << 3; |
| 26 | dest--; |
| 27 | src--; |
| 28 | } |
| 29 | if (flip_dir) |
| 30 | src+=2*width; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | static rgb32ToRgb24(STDCONV_PARAMS) |
| 35 | { |
| 36 | col* dest; |
| 37 | dest=(col*)to+width*height-1; |
| 38 | if(!flip_dir) |
| 39 | from+=4*(width*height-1); |
| 40 | else |
| 41 | from+=4*(width-1); |
| 42 | for(int i=height-1; i>=0; i--) |
| 43 | { |
| 44 | for(int j=width-1; j>=0; j--) |
| 45 | { |
| 46 | *dest=*(const col*)from; |
| 47 | dest--; |
| 48 | from-=4; |
| 49 | } |
| 50 | if(flip_dir)from+=8*width; |
| 51 | } |
| 52 | } |