changeset 33115:c2da7b725fd8

Use appropriate data type uint32_t for 32 bpp bitmap data. Don't use int. Besides, rename variable holding transparent color.
author ib
date Mon, 04 Apr 2011 13:02:56 +0000
parents 5ad451a5ebec
children 00cea1a6740a
files gui/util/bitmap.c gui/util/bitmap.h
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/bitmap.c	Mon Apr 04 12:40:20 2011 +0000
+++ b/gui/util/bitmap.c	Mon Apr 04 13:02:56 2011 +0000
@@ -216,7 +216,7 @@
     memset(bf, 0, sizeof(*bf));
 }
 
-int Convert32to1(txSample *in, txSample *out, int adaptivlimit)
+int Convert32to1(txSample *in, txSample *out, uint32_t transparent)
 {
     out->Width     = in->Width;
     out->Height    = in->Height;
@@ -230,14 +230,14 @@
         return 0;
     } else {
         int i, b, c = 0;
-        unsigned int *buf = NULL;
+        uint32_t *buf     = NULL;
         unsigned char tmp = 0;
         int nothaveshape  = 1;
 
-        buf = (unsigned int *)in->Image;
+        buf = (uint32_t *)in->Image;
 
         for (b = 0, i = 0; i < (int)(out->Width * out->Height); i++) {
-            if ((int)buf[i] != adaptivlimit)
+            if (buf[i] != transparent)
                 tmp = (tmp >> 1) | 128;
             else {
                 tmp    = tmp >> 1;
--- a/gui/util/bitmap.h	Mon Apr 04 12:40:20 2011 +0000
+++ b/gui/util/bitmap.h	Mon Apr 04 13:02:56 2011 +0000
@@ -19,6 +19,8 @@
 #ifndef MPLAYER_GUI_BITMAP_H
 #define MPLAYER_GUI_BITMAP_H
 
+#include <inttypes.h>
+
 typedef struct {
     unsigned long Width;
     unsigned long Height;
@@ -29,6 +31,6 @@
 
 void bpFree(txSample *bf);
 int bpRead(char *fname, txSample *bf);
-int Convert32to1(txSample *in, txSample *out, int adaptivlimit);
+int Convert32to1(txSample *in, txSample *out, uint32_t transparent);
 
 #endif /* MPLAYER_GUI_BITMAP_H */