From: <enl...@li...> - 2004-07-10 21:42:10
|
Enlightenment CVS committal Author : atmosphere Project : e17 Module : libs/esmart Dir : e17/libs/esmart/src/lib/esmart_thumb Modified Files: esmart_thumb.c Log Message: try evas's native image loaders before falling back to imlib2, should be quicker for jpeg and png, entice feels quicker atleast =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_thumb/esmart_thumb.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -3 -r1.1.1.1 -r1.2 --- esmart_thumb.c 5 May 2004 05:57:01 -0000 1.1.1.1 +++ esmart_thumb.c 10 Jul 2004 21:42:04 -0000 1.2 @@ -137,24 +137,41 @@ if ((e = (Esmart_Thumb *) evas_object_smart_data_get (o))) { Imlib_Image tmp = NULL; + int iw = 0, ih = 0; - tmp = imlib_load_image_immediately_without_cache (e->e->src); - if (tmp) - { - if (!e->info) - e->info = epsilon_info_get (e->e); - imlib_context_set_image (tmp); + if (!e->info) + e->info = epsilon_info_get (e->e); + result = evas_object_image_add (evas_object_evas_get (o)); + + evas_object_image_file_set (result, e->e->src, NULL); - result = evas_object_image_add (evas_object_evas_get (o)); + switch (evas_object_image_load_error_get (result)) + { + case EVAS_LOAD_ERROR_NONE: + evas_object_image_size_get (result, &iw, &ih); if (e->info->w == 0) - e->info->w = imlib_image_get_width (); + e->info->w = iw; if (e->info->h == 0) - e->info->h = imlib_image_get_height (); - evas_object_image_size_set (result, e->info->w, e->info->h); - evas_object_image_alpha_set (result, imlib_image_has_alpha ()); - evas_object_image_data_copy_set (result, - imlib_image_get_data ()); - imlib_free_image_and_decache (); + e->info->h = ih; + break; + default: + tmp = imlib_load_image_immediately_without_cache (e->e->src); + if (tmp) + { + imlib_context_set_image (tmp); + + if (e->info->w == 0) + e->info->w = imlib_image_get_width (); + if (e->info->h == 0) + e->info->h = imlib_image_get_height (); + evas_object_image_alpha_set (result, + imlib_image_has_alpha ()); + evas_object_image_size_set (result, e->info->w, e->info->h); + evas_object_image_data_copy_set (result, + imlib_image_get_data ()); + imlib_free_image_and_decache (); + } + break; } } } |