diff options
author | lu_zero <lu_zero@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-28 16:36:41 +0000 |
---|---|---|
committer | lu_zero <lu_zero@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-28 16:36:41 +0000 |
commit | a1fe76958b6500e305f9bac0dd1d312706f54da2 (patch) | |
tree | a63c9777519126a836012c2c1c5e7e62302531b4 | |
parent | 254548c4b39fb7d5e5c7ab054cc48398ffcc030d (diff) | |
download | mpv-a1fe76958b6500e305f9bac0dd1d312706f54da2.tar.bz2 mpv-a1fe76958b6500e305f9bac0dd1d312706f54da2.tar.xz |
fix endianess, see bug #727
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22044 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/vo_tga.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libvo/vo_tga.c b/libvo/vo_tga.c index fc5531db6a..83c98d1972 100644 --- a/libvo/vo_tga.c +++ b/libvo/vo_tga.c @@ -37,14 +37,6 @@ #include "video_out.h" #include "video_out_internal.h" -#ifdef WORDS_BIGENDIAN -#define TGA_ALPHA32 0x000000ff -#define TGA_SHIFT32 8 -#else -#define TGA_ALPHA32 0xff000000 -#define TGA_SHIFT32 0 -#endif - static vo_info_t info = { "Targa output", @@ -121,14 +113,26 @@ static int write_tga( char *file, int bpp, int dx, int dy, uint8_t *buf, int str if (bpp == 32) { /* Setup the alpha channel for every pixel */ while (dy-- > 0) { - uint32_t *d; - uint32_t *s; + uint8_t *d; + uint8_t *s; int x; - s = (uint32_t *)buf; + s = buf; d = line_buff; for(x = 0; x < dx; x++) { - *d++ = ((*s++) << TGA_SHIFT32) | TGA_ALPHA32; + #ifdef WORDS_BIGENDIAN + d[0] = s[3]; + d[1] = s[2]; + d[2] = s[1]; + d[3] = 0xff; + #else + d[0] = 0xff; + d[1] = s[1]; + d[2] = s[2]; + d[3] = s[3]; + #endif + d+=4; + s+=4; } if (fwrite(line_buff, wb, 1, fo) != 1) { er = 4; |