[MPlayer-cvslog] r34071 - in trunk/gui/util: bitmap.c bitmap.h

ib subversion at mplayerhq.hu
Tue Sep 6 16:59:05 CEST 2011


Author: ib
Date: Tue Sep  6 16:59:04 2011
New Revision: 34071

Log:
Cosmetic: Rename parameters bf img in bitmap.c.

Modified:
   trunk/gui/util/bitmap.c
   trunk/gui/util/bitmap.h

Modified: trunk/gui/util/bitmap.c
==============================================================================
--- trunk/gui/util/bitmap.c	Tue Sep  6 15:37:32 2011	(r34070)
+++ trunk/gui/util/bitmap.c	Tue Sep  6 16:59:04 2011	(r34071)
@@ -30,7 +30,7 @@
 #include "libvo/fastmemcpy.h"
 #include "mp_msg.h"
 
-static int pngRead(const char *fname, guiImage *bf)
+static int pngRead(const char *fname, guiImage *img)
 {
     FILE *file;
     long len;
@@ -85,45 +85,45 @@ static int pngRead(const char *fname, gu
 
     avcodec_decode_video2(avctx, frame, &decode_ok, &pkt);
 
-    memset(bf, 0, sizeof(*bf));
+    memset(img, 0, sizeof(*img));
 
     switch (avctx->pix_fmt) {
     case PIX_FMT_GRAY8:
-        bf->Bpp = 8;
+        img->Bpp = 8;
         break;
 
     case PIX_FMT_GRAY16BE:
-        bf->Bpp = 16;
+        img->Bpp = 16;
         break;
 
     case PIX_FMT_RGB24:
-        bf->Bpp = 24;
+        img->Bpp = 24;
         break;
 
     case PIX_FMT_BGRA:
     case PIX_FMT_ARGB:
-        bf->Bpp = 32;
+        img->Bpp = 32;
         break;
 
     default:
-        bf->Bpp = 0;
+        img->Bpp = 0;
         break;
     }
 
-    if (decode_ok && bf->Bpp) {
-        bf->Width  = avctx->width;
-        bf->Height = avctx->height;
-        bpl = bf->Width * (bf->Bpp / 8);
-        bf->ImageSize = bpl * bf->Height;
+    if (decode_ok && img->Bpp) {
+        img->Width  = avctx->width;
+        img->Height = avctx->height;
+        bpl = img->Width * (img->Bpp / 8);
+        img->ImageSize = bpl * img->Height;
 
         mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] file: %s\n", fname);
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap]  size: %lux%lu, color depth: %u\n", bf->Width, bf->Height, bf->Bpp);
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap]  image size: %lu\n", bf->ImageSize);
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap]  size: %lux%lu, color depth: %u\n", img->Width, img->Height, img->Bpp);
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap]  image size: %lu\n", img->ImageSize);
 
-        bf->Image = malloc(bf->ImageSize);
+        img->Image = malloc(img->ImageSize);
 
-        if (bf->Image)
-            memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]);
+        if (img->Image)
+            memcpy_pic(img->Image, frame->data[0], bpl, img->Height, bpl, frame->linesize[0]);
         else
             decode_ok = 0;
     }
@@ -133,31 +133,31 @@ static int pngRead(const char *fname, gu
     av_free(avctx);
     av_free(data);
 
-    return !(decode_ok && bf->Bpp);
+    return !(decode_ok && img->Bpp);
 }
 
-static int Convert24to32(guiImage *bf)
+static int Convert24to32(guiImage *img)
 {
     char *orgImage;
     unsigned long i, c;
 
-    if (bf->Bpp == 24) {
-        orgImage = bf->Image;
+    if (img->Bpp == 24) {
+        orgImage = img->Image;
 
-        bf->Bpp       = 32;
-        bf->ImageSize = bf->Width * bf->Height * 4;
-        bf->Image     = calloc(1, bf->ImageSize);
+        img->Bpp       = 32;
+        img->ImageSize = img->Width * img->Height * 4;
+        img->Image     = calloc(1, img->ImageSize);
 
-        if (!bf->Image) {
+        if (!img->Image) {
             free(orgImage);
-            mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", bf->ImageSize);
+            mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", img->ImageSize);
             return 0;
         }
 
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] 32 bpp conversion size: %lu\n", bf->ImageSize);
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] 32 bpp conversion size: %lu\n", img->ImageSize);
 
-        for (c = 0, i = 0; c < bf->ImageSize; c += 4, i += 3)
-            *(uint32_t *)&bf->Image[c] = ALPHA_OPAQUE | AV_RB24(&orgImage[i]);
+        for (c = 0, i = 0; c < img->ImageSize; c += 4, i += 3)
+            *(uint32_t *)&img->Image[c] = ALPHA_OPAQUE | AV_RB24(&orgImage[i]);
 
         free(orgImage);
     }
@@ -184,7 +184,7 @@ static const char *fExist(const char *fn
     return NULL;
 }
 
-int bpRead(const char *fname, guiImage *bf)
+int bpRead(const char *fname, guiImage *img)
 {
     int r;
 
@@ -193,28 +193,28 @@ int bpRead(const char *fname, guiImage *
     if (!fname)
         return -2;
 
-    r = pngRead(fname, bf);
+    r = pngRead(fname, img);
 
     if (r != 0) {
         mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] read error #%d: %s\n", r, fname);
         return -5;
     }
 
-    if (bf->Bpp < 24) {
-        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] bpp too low: %u\n", bf->Bpp);
+    if (img->Bpp < 24) {
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] bpp too low: %u\n", img->Bpp);
         return -1;
     }
 
-    if (!Convert24to32(bf))
+    if (!Convert24to32(img))
         return -8;
 
     return 0;
 }
 
-void bpFree(guiImage *bf)
+void bpFree(guiImage *img)
 {
-    free(bf->Image);
-    memset(bf, 0, sizeof(*bf));
+    free(img->Image);
+    memset(img, 0, sizeof(*img));
 }
 
 int bpRenderMask(const guiImage *in, guiImage *out)

Modified: trunk/gui/util/bitmap.h
==============================================================================
--- trunk/gui/util/bitmap.h	Tue Sep  6 15:37:32 2011	(r34070)
+++ trunk/gui/util/bitmap.h	Tue Sep  6 16:59:04 2011	(r34071)
@@ -33,8 +33,8 @@ typedef struct {
     char *Image;
 } guiImage;
 
-void bpFree(guiImage *bf);
-int bpRead(const char *fname, guiImage *bf);
+void bpFree(guiImage *img);
+int bpRead(const char *fname, guiImage *img);
 int bpRenderMask(const guiImage *in, guiImage *out);
 
 #endif /* MPLAYER_GUI_BITMAP_H */


More information about the MPlayer-cvslog mailing list