[MPlayer-cvslog] r33205 - trunk/gui/util/bitmap.c

ib subversion at mplayerhq.hu
Mon Apr 4 15:49:57 CEST 2011


Author: ib
Date: Mon Apr  4 15:49:57 2011
New Revision: 33205

Log:
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.

Modified:
   trunk/gui/util/bitmap.c

Modified: trunk/gui/util/bitmap.c
==============================================================================
--- trunk/gui/util/bitmap.c	Mon Apr  4 15:24:00 2011	(r33204)
+++ trunk/gui/util/bitmap.c	Mon Apr  4 15:49:57 2011	(r33205)
@@ -218,27 +218,27 @@ void bpFree(txSample *bf)
 
 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;


More information about the MPlayer-cvslog mailing list