diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2005-01-19 00:59:27 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2005-01-19 00:59:27 +0000 |
commit | ddcbc3dd52dce80af430dd3b21b606373707cfa3 (patch) | |
tree | 6445d97ee4cf702cddf8fb8dae3e6e8e2681fad9 /src | |
parent | 3118549a0590dea62a76c568a7a14b8e3fdb90d1 (diff) | |
download | xine-lib-ddcbc3dd52dce80af430dd3b21b606373707cfa3.tar.gz xine-lib-ddcbc3dd52dce80af430dd3b21b606373707cfa3.tar.bz2 |
Distorted image fix:
- set the displayed bitmap's width to a multiple of 8 (round up);
- centre the image within this.
Incorrect colours fix:
- use RGB8 instead of BGR8.
Shout if these break things :-)
CVS patchset: 7363
CVS date: 2005/01/19 00:59:27
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/demux_mng.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index 5d5221606..88458278f 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mng.c,v 1.23 2004/06/13 21:28:53 miguelfreitas Exp $ + * $Id: demux_mng.c,v 1.24 2005/01/19 00:59:40 dsalt Exp $ * * demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format * @@ -62,6 +62,7 @@ typedef struct { mng_handle mngh; xine_bmiheader bih; + int left_edge; uint8_t *image; int started; @@ -113,12 +114,13 @@ static mng_bool mymng_read_stream(mng_handle mngh, mng_ptr buffer, mng_uint32 si static mng_bool mymng_process_header(mng_handle mngh, mng_uint32 width, mng_uint32 height){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); - this->bih.biWidth = width; + this->bih.biWidth = (width + 7) & ~7; this->bih.biHeight = height; + this->left_edge = (this->bih.biWidth - width) / 2; - this->image = malloc(width * height * 3); + this->image = malloc(this->bih.biWidth * height * 3); - mng_set_canvasstyle(mngh, MNG_CANVAS_BGR8); + mng_set_canvasstyle(mngh, MNG_CANVAS_RGB8); return MNG_TRUE; } @@ -140,7 +142,7 @@ static mng_bool mymng_set_timer(mng_handle mngh, mng_uint32 msecs){ static mng_ptr mymng_get_canvas_line(mng_handle mngh, mng_uint32 line){ demux_mng_t *this = (demux_mng_t*)mng_get_userdata(mngh); - return this->image + line * this->bih.biWidth * 3; + return this->image + (this->left_edge + line * this->bih.biWidth) * 3; } static mng_bool mymng_refresh(mng_handle mngh, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h){ |