changeset 33983:2218c589f9ab

Cosmetic: Rename parameters bf img in bitmap.c.
author ib
date Tue, 06 Sep 2011 14:59:04 +0000
parents d7527ee45784
children 60449f4234f7
files gui/util/bitmap.c gui/util/bitmap.h
diffstat 2 files changed, 39 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/bitmap.c	Tue Sep 06 13:37:32 2011 +0000
+++ b/gui/util/bitmap.c	Tue Sep 06 14:59:04 2011 +0000
@@ -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 @@
 
     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 @@
     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 @@
     return NULL;
 }
 
-int bpRead(const char *fname, guiImage *bf)
+int bpRead(const char *fname, guiImage *img)
 {
     int r;
 
@@ -193,28 +193,28 @@
     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)
--- a/gui/util/bitmap.h	Tue Sep 06 13:37:32 2011 +0000
+++ b/gui/util/bitmap.h	Tue Sep 06 14:59:04 2011 +0000
@@ -33,8 +33,8 @@
     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 */