comparison gui/util/bitmap.c @ 33114:5ad451a5ebec

Remove useless warning message. Instead, add debug message and return whether conversion was successful or not and use the return code to issue an appropriate error message.
author ib
date Mon, 04 Apr 2011 12:40:20 +0000
parents cc6d4af87b99
children c2da7b725fd8
comparison
equal deleted inserted replaced
33113:cc6d4af87b99 33114:5ad451a5ebec
214 { 214 {
215 free(bf->Image); 215 free(bf->Image);
216 memset(bf, 0, sizeof(*bf)); 216 memset(bf, 0, sizeof(*bf));
217 } 217 }
218 218
219 void Convert32to1(txSample *in, txSample *out, int adaptivlimit) 219 int Convert32to1(txSample *in, txSample *out, int adaptivlimit)
220 { 220 {
221 out->Width = in->Width; 221 out->Width = in->Width;
222 out->Height = in->Height; 222 out->Height = in->Height;
223 out->BPP = 1; 223 out->BPP = 1;
224 out->ImageSize = (out->Width * out->Height + 7) / 8; 224 out->ImageSize = (out->Width * out->Height + 7) / 8;
225 225
226 out->Image = calloc(1, out->ImageSize); 226 out->Image = calloc(1, out->ImageSize);
227 227
228 if (out->Image == NULL) 228 if (out->Image == NULL) {
229 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_NotEnoughMemoryC32To1); 229 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory: %lu\n", out->ImageSize);
230 else { 230 return 0;
231 } else {
231 int i, b, c = 0; 232 int i, b, c = 0;
232 unsigned int *buf = NULL; 233 unsigned int *buf = NULL;
233 unsigned char tmp = 0; 234 unsigned char tmp = 0;
234 int nothaveshape = 1; 235 int nothaveshape = 1;
235 236
257 if (nothaveshape) { 258 if (nothaveshape) {
258 free(out->Image); 259 free(out->Image);
259 out->Image = NULL; 260 out->Image = NULL;
260 } 261 }
261 } 262 }
262 } 263
264 return 1;
265 }