From: <enl...@li...> - 2000-12-02 01:49:28
|
Enlightenment CVS committal Author : gilbertt Project : misc Module : camE Modified Files: webcam.c Log Message: Feck. Was leaking imlib_fonts and doing something else dumb I don't remember now. Oh yeah, reading the message from the file twice each time :-) I suck. =================================================================== RCS file: /cvsroot/enlightenment/misc/camE/webcam.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- webcam.c 2000/11/23 22:25:31 1.11 +++ webcam.c 2000/12/02 01:49:20 1.12 @@ -76,6 +76,7 @@ char *overlay_file = NULL; Imlib_Image overlay_im = NULL; int overlay_x = 0, overlay_y = 0; +Imlib_Font title_fn, text_fn; /* these work for v4l only, not v4l2 */ int grab_input = 0; @@ -217,8 +218,6 @@ struct tm *tm; char line[255], title_line[255]; int len; - char *msg; - Imlib_Font title_fn, text_fn; int x, y, w, h; time(&t); @@ -227,9 +226,8 @@ if (title_text) strftime(title_line, 254, title_text, tm); - msg = get_message(); - if (msg) - strcat(line, msg); + if (message) + strcat(line, message); line[127] = '\0'; len = strlen(line); @@ -239,36 +237,28 @@ if (title_text) { - title_fn = imlib_load_font(title_font); - if (title_fn) - { - gib_imlib_get_text_size(title_fn, title_line, title_style, &w, &h, - IMLIB_TEXT_TO_RIGHT); - x = width - w - 2; - y = 2; - gib_imlib_image_fill_rectangle(image, x - 2, y - 1, w + 4, h + 2, - bg_r, bg_g, bg_b, bg_a); - gib_imlib_text_draw(image, title_fn, title_style, x, y, title_line, - IMLIB_TEXT_TO_RIGHT, title_r, title_g, title_b, - title_a); - } + gib_imlib_get_text_size(title_fn, title_line, title_style, &w, &h, + IMLIB_TEXT_TO_RIGHT); + x = width - w - 2; + y = 2; + gib_imlib_image_fill_rectangle(image, x - 2, y - 1, w + 4, h + 2, bg_r, + bg_g, bg_b, bg_a); + gib_imlib_text_draw(image, title_fn, title_style, x, y, title_line, + IMLIB_TEXT_TO_RIGHT, title_r, title_g, title_b, + title_a); } if (line) { - text_fn = imlib_load_font(text_font); - if (text_fn) - { - gib_imlib_get_text_size(text_fn, line, text_style, &w, &h, - IMLIB_TEXT_TO_RIGHT); - x = 2; - y = height - h - 2; - gib_imlib_image_fill_rectangle(image, x - 2, y - 1, w + 4, h + 2, - bg_r, bg_g, bg_b, bg_a); - gib_imlib_text_draw(image, text_fn, text_style, x, y, line, - IMLIB_TEXT_TO_RIGHT, text_r, text_g, text_b, - text_a); - } + gib_imlib_get_text_size(text_fn, line, text_style, &w, &h, + IMLIB_TEXT_TO_RIGHT); + x = 2; + y = height - h - 2; + gib_imlib_image_fill_rectangle(image, x - 2, y - 1, w + 4, h + 2, bg_r, + bg_g, bg_b, bg_a); + gib_imlib_text_draw(image, text_fn, text_style, x, y, line, + IMLIB_TEXT_TO_RIGHT, text_r, text_g, text_b, + text_a); } } @@ -526,6 +516,12 @@ text_style = gib_style_new_from_ascii(text_style_file); if (overlay_file) overlay_im = imlib_load_image(overlay_file); + title_fn = imlib_load_font(title_font); + if (!title_fn) + fprintf(stderr, "can't load font %s\n", title_font); + text_fn = imlib_load_font(text_font); + if (!text_fn) + fprintf(stderr, "can't load font %s\n", text_font); if (ftp_do) { |