Mercurial > mplayer.hg
changeset 33118:ae464a957cd0
Move variable definitions at top of function.
Besides, remove pointless initialization of buf, add initialization
for b, make i match Width and Height, express char constant 128 as
hexadecimal const, and remove a newline for cosmetic reasons.
author | ib |
---|---|
date | Mon, 04 Apr 2011 13:49:57 +0000 |
parents | 8db0a5bf65d9 |
children | 8835e684a41d |
files | gui/util/bitmap.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/util/bitmap.c Mon Apr 04 13:24:00 2011 +0000 +++ b/gui/util/bitmap.c Mon Apr 04 13:49:57 2011 +0000 @@ -218,27 +218,27 @@ int Convert32to1(txSample *in, txSample *out, uint32_t transparent) { + uint32_t *buf; + unsigned long i; + int b = 0, c = 0; + unsigned char tmp = 0; + int shaped = 0; + out->Width = in->Width; out->Height = in->Height; out->BPP = 1; out->ImageSize = (out->Width * out->Height + 7) / 8; - - out->Image = calloc(1, out->ImageSize); + out->Image = calloc(1, out->ImageSize); if (out->Image == NULL) { mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", out->ImageSize); return 0; } else { - int i, b, c = 0; - uint32_t *buf = NULL; - unsigned char tmp = 0; - int shaped = 0; - buf = (uint32_t *)in->Image; - for (b = 0, i = 0; i < (int)(out->Width * out->Height); i++) { + for (i = 0; i < out->Width * out->Height; i++) { if (buf[i] != transparent) - tmp = (tmp >> 1) | 128; + tmp = (tmp >> 1) | 0x80; else { tmp = tmp >> 1; buf[i] = 0;