diff options
author | Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org> | 2014-12-02 11:55:14 +0100 |
---|---|---|
committer | Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org> | 2014-12-03 15:08:19 +0100 |
commit | f0be21988c9b0a4d165d386f8062a4bf2f5b095b (patch) | |
tree | 932c32cc203851222e63b7adac4be53d73e8b6b4 /src/util/media-thumb-util.c | |
parent | 561e2cae46730cdbadf485dfa7ab449e60524bae (diff) | |
download | libmedia-thumbnail-f0be21988c9b0a4d165d386f8062a4bf2f5b095b.tar.gz libmedia-thumbnail-f0be21988c9b0a4d165d386f8062a4bf2f5b095b.tar.bz2 libmedia-thumbnail-f0be21988c9b0a4d165d386f8062a4bf2f5b095b.zip |
Remove Ecore evas dependencysubmit/tizen_mobile/20141216.000000submit/tizen_common/20141211.110609accepted/tizen/common/20141211.134331
Librarie gdk-pixbuf is used to create thumbnail
instead of Ecore-evas
Bug-Tizen: TC-1694
Change-Id: Ib8facf8ec8d2d82ffaf5138a3b7e09ee5853b7b5
Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
Diffstat (limited to 'src/util/media-thumb-util.c')
-rwxr-xr-x | src/util/media-thumb-util.c | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c index 3f287bd..3cccc9e 100755 --- a/src/util/media-thumb-util.c +++ b/src/util/media-thumb-util.c @@ -26,11 +26,10 @@ #include <aul.h> #include <string.h> #include <drm_client.h> - -#include <Evas.h> -#include <Ecore_Evas.h> +#include <sys/stat.h> #include <grp.h> #include <pwd.h> +#include <sys/smack.h> #define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO @@ -339,58 +338,30 @@ _media_thumb_get_hash_name(const char *file_full_path, return 0; } - -int _media_thumb_save_to_file_with_evas(unsigned char *data, +int _media_thumb_save_to_file_with_gdk(GdkPixbuf *data, int w, int h, - int alpha, + gboolean alpha, char *thumb_path) { - Ecore_Evas *ee = - ecore_evas_buffer_new(w, h); - if (ee == NULL) { - thumb_err("Failed to create a new ecore evas buffer\n"); - return -1; - } - - Evas *evas = ecore_evas_get(ee); - if (evas == NULL) { - thumb_err("Failed to ecore_evas_get\n"); - ecore_evas_free(ee); + GError *error = NULL; + + gdk_pixbuf_save(data,thumb_path,"jpeg", &error, NULL); + if (error) { + thumb_dbg ("Error saving image file %s", thumb_path); + g_error_free (error); return -1; } - Evas_Object *img = NULL; - img = evas_object_image_add(evas); - - if (img == NULL) { - thumb_err("image object is NULL\n"); - ecore_evas_free(ee); + if(smack_setlabel(thumb_path, "User", SMACK_LABEL_ACCESS)){ + thumb_dbg("failed chsmack -a \"User\" %s", thumb_path); return -1; - } - - evas_object_image_colorspace_set(img, EVAS_COLORSPACE_ARGB8888); - evas_object_image_size_set(img, w, h); - evas_object_image_fill_set(img, 0, 0, w, h); - - if (alpha) evas_object_image_alpha_set(img, 1); - - evas_object_image_data_set(img, data); - evas_object_image_data_update_add(img, 0, 0, w, h); - - if (evas_object_image_save - (img, thumb_path, NULL, "quality=100 compress=1")) { - thumb_dbg("evas_object_image_save success\n"); - ecore_evas_free(ee); - - return 0; } else { - thumb_dbg("evas_object_image_save failed\n"); - ecore_evas_free(ee); - return -1; + thumb_dbg("chsmack -a \"User\" %s", thumb_path); } -} + return 0; +} int _thumbnail_get_data(const char *origin_path, media_thumb_type thumb_type, |