Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_thumb.c Log Message: if image fails to load - give up. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_thumb.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- e_thumb.c 21 Oct 2005 03:35:14 -0000 1.5 +++ e_thumb.c 21 Oct 2005 09:25:23 -0000 1.6 @@ -90,45 +90,51 @@ return -1; } - ef = eet_open(thumbpath, EET_FILE_MODE_WRITE); - if (!ef) - { - free(thumbpath); - return -1; - } - - free(thumbpath); - - buf = ecore_evas_buffer_new(w, h); + buf = ecore_evas_buffer_new(1, 1); evasbuf = ecore_evas_get(buf); im = evas_object_image_add(evasbuf); evas_object_image_file_set(im, file, NULL); iw = 0; ih = 0; evas_object_image_size_get(im, &iw, &ih); alpha = evas_object_image_alpha_get(im); - ww = w; - hh = (w * ih) / iw; - if (hh > h) + if ((iw > 0) && (ih > 0)) { - hh = h; - ww = (h * iw) / ih; + ef = eet_open(thumbpath, EET_FILE_MODE_WRITE); + if (!ef) + { + free(thumbpath); + evas_object_del(im); + ecore_evas_free(buf); + return -1; + } + free(thumbpath); + + ww = w; + hh = (w * ih) / iw; + if (hh > h) + { + hh = h; + ww = (h * iw) / ih; + } + ecore_evas_resize(buf, ww, hh); + evas_object_image_fill_set(im, 0, 0, ww, hh); + evas_object_resize(im, ww, hh); + evas_object_show(im); + data = ecore_evas_buffer_pixels_get(buf); + + eet_write(ef, "/thumbnail/orig_path", file, strlen(file), 1); + if ((size = eet_data_image_write(ef, "/thumbnail/data", + (void *)data, ww, hh, alpha, + 0, 91, 1)) <= 0) + { + evas_object_del(im); + ecore_evas_free(buf); + eet_close(ef); + return -1; + } + eet_close(ef); } - ecore_evas_resize(buf, ww, hh); - evas_object_image_fill_set(im, 0, 0, ww, hh); - evas_object_resize(im, ww, hh); - evas_object_show(im); - data = ecore_evas_buffer_pixels_get(buf); - - eet_write(ef, "/thumbnail/orig_path", file, strlen(file), 1); - if ((size = eet_data_image_write(ef, "/thumbnail/data", - (void *)data, ww, hh, alpha, - 0, 91, 1)) <= 0) - { - eet_close(ef); - return -1; - } evas_object_del(im); - eet_close(ef); ecore_evas_free(buf); return 1; } ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs