From f0be21988c9b0a4d165d386f8062a4bf2f5b095b Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Tue, 2 Dec 2014 11:55:14 +0100 Subject: Remove Ecore evas dependency 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 --- CMakeLists.txt | 2 +- packaging/libmedia-thumbnail.spec | 3 +- server/thumb-server-internal.c | 8 +- server/thumb-server.c | 19 ++-- src/include/media-thumb-internal.h | 5 +- src/include/util/media-thumb-util.h | 5 +- src/ipc/media-thumb-ipc.c | 12 +-- src/media-thumb-internal.c | 184 +++++++++--------------------------- src/util/media-thumb-util.c | 59 +++--------- test/test-thumb.c | 77 ++------------- 10 files changed, 91 insertions(+), 283 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26cbfed..cc114a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo drm-client aul -libexif ecore ecore-evas evas mmutil-imgp mmutil-jpeg heynoti libmedia-utils vconf libtzplatform-config) +libexif mmutil-imgp mmutil-jpeg heynoti libmedia-utils vconf libtzplatform-config gdk-pixbuf-2.0) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec index 7acb0bd..7fb7d29 100644 --- a/packaging/libmedia-thumbnail.spec +++ b/packaging/libmedia-thumbnail.spec @@ -13,8 +13,6 @@ BuildRequires: cmake BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(drm-client) -BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(heynoti) BuildRequires: pkgconfig(libexif) BuildRequires: pkgconfig(libmedia-utils) @@ -23,6 +21,7 @@ BuildRequires: pkgconfig(mmutil-imgp) BuildRequires: pkgconfig(mmutil-jpeg) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(gdk-pixbuf-2.0) Requires: media-server %description diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c index cc65652..6de74ad 100755 --- a/server/thumb-server-internal.c +++ b/server/thumb-server-internal.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #ifdef LOG_TAG @@ -65,9 +64,8 @@ void _thumb_daemon_finish_jobs() thumb_dbg("sqlite3 handle is alive. So disconnect to sqlite3"); } - /* Shutdown ecore-evas */ - ecore_evas_shutdown(); - + g_main_loop_quit(g_thumb_server_mainloop); + return; } @@ -404,7 +402,7 @@ gboolean _thumb_server_read_socket(GIOChannel *src, if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) { thumb_warn("Shutting down..."); - ecore_main_loop_quit(); + g_main_loop_quit(g_thumb_server_mainloop); } return TRUE; diff --git a/server/thumb-server.c b/server/thumb-server.c index bed8711..ca5fd48 100755 --- a/server/thumb-server.c +++ b/server/thumb-server.c @@ -30,8 +30,6 @@ #include //#include //#include -#include -#include #ifdef LOG_TAG @@ -49,7 +47,7 @@ static void _media_thumb_signal_handler(void *user_data) thumb_dbg("Singal Hander for HEYNOTI \"power_off_start\""); if (g_thumb_server_mainloop) - ecore_main_loop_quit(); + g_main_loop_quit(g_thumb_server_mainloop); else exit(1); @@ -98,7 +96,7 @@ int main() return -1; } - context = g_main_context_default (); + g_thumb_server_mainloop = g_main_loop_new(context, FALSE); /* Create new channel to watch udp socket */ channel = g_io_channel_unix_new(sockfd); @@ -108,10 +106,10 @@ int main() g_source_set_callback(source, (GSourceFunc)_thumb_server_read_socket, NULL, NULL); g_source_attach(source, context); - GSource *source_evas_init = NULL; - source_evas_init = g_idle_source_new (); - g_source_set_callback (source_evas_init, _thumb_daemon_start_jobs, NULL, NULL); - g_source_attach (source_evas_init, context); + GSource *source_init = NULL; + source_init = g_idle_source_new (); + g_source_set_callback (source_init, _thumb_daemon_start_jobs, NULL, NULL); + g_source_attach (source_init, context); /* Would be used when glib 2.32 is installed GSource *sig_handler_src = NULL; @@ -119,14 +117,13 @@ int main() g_source_set_callback(sig_handler_src, (GSourceFunc)_media_thumb_signal_handler, NULL, NULL); g_source_attach(sig_handler_src, context); */ - ecore_evas_init(); thumb_dbg("************************************"); thumb_dbg("*** Thumbnail server is running ***"); thumb_dbg("************************************"); - ecore_main_loop_begin(); - + g_main_loop_run(g_thumb_server_mainloop); + thumb_dbg("Thumbnail server is shutting down..."); g_io_channel_shutdown(channel, FALSE, NULL); diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h index 32427ca..e9990b2 100755 --- a/src/include/media-thumb-internal.h +++ b/src/include/media-thumb-internal.h @@ -24,6 +24,7 @@ #include "media-thumb-error.h" #include "media-thumb-types.h" #include "media-thumb-debug.h" +#include #ifndef _MEDIA_THUMB_INTERNAL_H_ #define _MEDIA_THUMB_INTERNAL_H_ @@ -43,8 +44,8 @@ typedef struct { int height; int origin_width; int origin_height; - int alpha; - unsigned char *data; + gboolean alpha; + GdkPixbuf *data; } media_thumb_info; enum Exif_Orientation { diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h index 4fe33f8..41409d2 100755 --- a/src/include/util/media-thumb-util.h +++ b/src/include/util/media-thumb-util.h @@ -24,6 +24,7 @@ #include "media-thumb-debug.h" #include "media-util.h" #include +#include #ifndef _MEDIA_THUMB_UTIL_H_ #define _MEDIA_THUMB_UTIL_H_ @@ -75,10 +76,10 @@ _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid); int -_media_thumb_save_to_file_with_evas(unsigned char *data, +_media_thumb_save_to_file_with_gdk(GdkPixbuf *data, int w, int h, - int alpha, + gboolean alpha, char *thumb_path); int diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c index 84cc682..b8ec1a5 100755 --- a/src/ipc/media-thumb-ipc.c +++ b/src/ipc/media-thumb-ipc.c @@ -522,7 +522,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) { int err = -1; - unsigned char *data = NULL; + GdkPixbuf *data = NULL; int thumb_size = 0; int thumb_w = 0; int thumb_h = 0; @@ -599,7 +599,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, uid); if (err < 0) { thumb_err("_thumbnail_get_data failed - %d\n", err); - SAFE_FREE(data); + g_object_unref(data); strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length); _media_thumb_db_disconnect(); @@ -630,10 +630,10 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) thumb_dbg("Thumb path is changed : %s", thumb_path); } - err = _media_thumb_save_to_file_with_evas(data, thumb_w, thumb_h, alpha, thumb_path); + err = _media_thumb_save_to_file_with_gdk(data, thumb_w, thumb_h, alpha, thumb_path); if (err < 0) { - thumb_err("save_to_file_with_evas failed - %d\n", err); - SAFE_FREE(data); + thumb_err("save_to_file_with_gdk failed - %d\n", err); + g_object_unref(data); if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA) strncpy(thumb_path, _media_thumb_get_default_path(uid), max_length); @@ -659,7 +659,7 @@ _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid) } /* End of fsync */ - SAFE_FREE(data); + g_object_unref(data); /* DB update if needed */ if (need_update_db == 1) { diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index fc0ca00..9fc6086 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -42,9 +42,8 @@ #include #include #include -#include -#include #include +#include #define MEDA_THUMB_ROUND_UP_4(num) (((num)+3)&~3) @@ -492,88 +491,49 @@ int _media_thumb_resize_data(unsigned char *src_data, return 0; } -int _media_thumb_get_wh_with_evas(const char *origin_path, int *width, int *height) -{ - /* using evas to get w/h */ - Ecore_Evas *ee = - ecore_evas_buffer_new(0, 0); - if (!ee) { - thumb_err("ecore_evas_new fails"); - return -1; - } - Evas *evas = ecore_evas_get(ee); - if (!evas) { - thumb_err("ecore_evas_get fails"); - ecore_evas_free(ee); - return -1; - } +int _media_thumb_get_wh_with_gdk(const char *origin_path, int *width, int *height) +{ - Evas_Object *image_object = - evas_object_image_add(evas); - if (!image_object) { - thumb_err - ("evas_object_image_add fails"); - ecore_evas_free(ee); + GdkPixbuf *pixbuf = NULL; + GError *error = NULL; + + pixbuf = gdk_pixbuf_new_from_file(origin_path, &error); + if (error) { + thumb_err ("Error loading image file %s",origin_path); + g_error_free (error); return -1; } - evas_object_image_file_set(image_object, - origin_path, - NULL); - evas_object_image_size_get(image_object, - width, height); - - thumb_dbg("Width:%d, Height:%d", *width, *height); - - ecore_evas_free(ee); + /* Get w/h of original image */ + *width = gdk_pixbuf_get_width(pixbuf); + *height = gdk_pixbuf_get_height(pixbuf); return 0; } -int _media_thumb_decode_with_evas(const char *origin_path, +int _media_thumb_decode_with_gdk(const char *origin_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info, int need_scale, int orientation) { - Ecore_Evas *resize_img_ee; - resize_img_ee = - ecore_evas_buffer_new(thumb_width, thumb_height); + GdkPixbuf *pixbuf = NULL; + GError *error = NULL; - if (!resize_img_ee) { - thumb_err("Failed to create a new ecore evas buffer\n"); + pixbuf = gdk_pixbuf_new_from_file(origin_path, &error); + if (error) { + thumb_err ("Error loading image file %s",origin_path); + g_error_free (error); return -1; } - Evas *resize_img_e = ecore_evas_get(resize_img_ee); - if (!resize_img_e) { - thumb_err("Failed to ecore_evas_get\n"); - ecore_evas_free(resize_img_ee); - return -1; - } - - Evas_Object *source_img = evas_object_image_add(resize_img_e); - if (!source_img) { - thumb_err("evas_object_image_add failed\n"); - ecore_evas_free(resize_img_ee); - return -1; - } - - evas_object_image_file_set(source_img, origin_path, NULL); - /* Get w/h of original image */ - int width = 0; - int height = 0; + int width = gdk_pixbuf_get_width(pixbuf); + int height = gdk_pixbuf_get_height(pixbuf); - evas_object_image_size_get(source_img, &width, &height); thumb_info->origin_width = width; thumb_info->origin_height = height; - //thumb_dbg("origin width:%d, origin height:%d", width, height); - if ((need_scale == 1) && (width * height > THUMB_MAX_ALLOWED_MEM_FOR_THUMB)) { - thumb_dbg("This is too large image. so this's scale is going to be down"); - evas_object_image_load_scale_down_set(source_img, 10); - } - evas_object_image_load_orientation_set(source_img, 1); + pixbuf = gdk_pixbuf_apply_embedded_orientation(pixbuf); int rotated_orig_w = 0; int rotated_orig_h = 0; @@ -586,8 +546,6 @@ int _media_thumb_decode_with_evas(const char *origin_path, rotated_orig_h = height; } - //thumb_dbg("rotated - origin width:%d, origin height:%d", rotated_orig_w, rotated_orig_h); - int err = -1; media_thumb_type thumb_type; @@ -602,61 +560,11 @@ int _media_thumb_decode_with_evas(const char *origin_path, &thumb_width, &thumb_height); if (err < 0) { thumb_err("_media_thumb_get_proper_thumb_size failed: %d", err); - ecore_evas_free(resize_img_ee); + g_object_unref(pixbuf); return err; } - ecore_evas_resize(resize_img_ee, thumb_width, thumb_height); - - evas_object_image_load_size_set(source_img, thumb_width, thumb_height); - evas_object_image_fill_set(source_img, - 0, 0, - thumb_width, - thumb_height); - - evas_object_image_filled_set(source_img, 1); - evas_object_resize(source_img, - thumb_width, - thumb_height); - evas_object_show(source_img); - - /* Set alpha from original */ - thumb_info->alpha = evas_object_image_alpha_get(source_img); - - /* Create target buffer and copy origin resized img to it */ - Ecore_Evas *target_ee = ecore_evas_buffer_new( - thumb_width, thumb_height); - if (!target_ee) { - thumb_err("Failed to create a ecore evas\n"); - ecore_evas_free(resize_img_ee); - return -1; - } - - Evas *target_evas = ecore_evas_get(target_ee); - if (!target_evas) { - thumb_err("Failed to ecore_evas_get\n"); - ecore_evas_free(resize_img_ee); - ecore_evas_free(target_ee); - return -1; - } - - Evas_Object *ret_image = - evas_object_image_add(target_evas); - - evas_object_image_size_set(ret_image, - thumb_width, - thumb_height); - - evas_object_image_fill_set(ret_image, 0, - 0, - thumb_width, - thumb_height); - - evas_object_image_filled_set(ret_image, EINA_TRUE); - evas_object_image_data_set(ret_image, - (int *)ecore_evas_buffer_pixels_get(resize_img_ee)); - evas_object_image_data_update_add(ret_image, 0, 0, thumb_width, - thumb_height); + pixbuf = gdk_pixbuf_scale_simple(pixbuf, thumb_width, thumb_height, GDK_INTERP_NEAREST); unsigned int buf_size = 0; @@ -664,23 +572,18 @@ int _media_thumb_decode_with_evas(const char *origin_path, thumb_height, &buf_size) < 0) { thumb_err("Failed to get buffer size"); - ecore_evas_free(resize_img_ee); - ecore_evas_free(target_ee); + g_object_unref(pixbuf); return MEDIA_THUMB_ERROR_MM_UTIL; } - //thumb_dbg("mm_util_get_image_size : %d", buf_size); - thumb_info->size = buf_size; + thumb_info->alpha = gdk_pixbuf_get_has_alpha(pixbuf); thumb_info->width = thumb_width; thumb_info->height = thumb_height; - thumb_info->data = malloc(buf_size); - memcpy(thumb_info->data, evas_object_image_data_get(ret_image, 1), buf_size); - - ecore_evas_free(target_ee); - ecore_evas_free(resize_img_ee); + thumb_info->data = gdk_pixbuf_copy(pixbuf); + g_object_unref(pixbuf); return 0; } @@ -696,7 +599,6 @@ mm_util_img_format _media_thumb_get_format(media_thumb_format src_format) } } - int _media_thumb_convert_data(media_thumb_info *thumb_info, int thumb_width, int thumb_height, @@ -858,10 +760,10 @@ int _media_thumb_png(const char *origin_path, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); - + err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); + if (err < 0) { - thumb_err("decode_with_evas failed : %d", err); + thumb_err("decode_with_gdk failed : %d", err); return err; } @@ -882,10 +784,10 @@ int _media_thumb_bmp(const char *origin_path, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); + err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); if (err < 0) { - thumb_err("decode_with_evas failed : %d", err); + thumb_err("decode_with_gdk failed : %d", err); return err; } @@ -906,10 +808,10 @@ int _media_thumb_wbmp(const char *origin_path, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); + err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); if (err < 0) { - thumb_err("decode_with_evas failed : %d", err); + thumb_err("decode_with_gdk failed : %d", err); return err; } @@ -930,10 +832,10 @@ int _media_thumb_gif(const char *origin_path, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); + err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, NORMAL); if (err < 0) { - thumb_err("decode_with_evas failed : %d", err); + thumb_err("decode_with_gdk failed : %d", err); return err; } @@ -999,10 +901,10 @@ int _media_thumb_jpeg(const char *origin_path, if (!thumb_done) { - err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0, orientation); - + err = _media_thumb_decode_with_gdk(origin_path, thumb_width, thumb_height, thumb_info, 0, orientation); + if (err < 0) { - thumb_err("decode_with_evas failed : %d", err); + thumb_err("decode_with_gdk failed : %d", err); return err; } @@ -1064,9 +966,9 @@ _media_thumb_image(const char *origin_path, int wbmp_width = 0; int wbmp_height = 0; - err = _media_thumb_get_wh_with_evas(origin_path, &wbmp_width, &wbmp_height); + err = _media_thumb_get_wh_with_gdk(origin_path, &wbmp_width, &wbmp_height); if (err < 0) { - thumb_err("_media_thumb_get_wh_with_evas in WBMP : %d", err); + thumb_err("_media_thumb_get_wh_with_gdk in WBMP : %d", err); return err; } 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 #include #include - -#include -#include +#include #include #include +#include #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, diff --git a/test/test-thumb.c b/test/test-thumb.c index 9fd5308..2d0c191 100755 --- a/test/test-thumb.c +++ b/test/test-thumb.c @@ -23,8 +23,6 @@ #include #include #include -#include -#include #include #include @@ -34,75 +32,16 @@ #include "media-thumb-ipc.h" #include "media-thumb-util.h" -int save_to_file_with_evas(unsigned char *data, int w, int h, int is_bgra) +int save_to_file_with_gdk(unsigned char *data, int w, int h, int is_bgra) { - ecore_evas_init(); + GError *error = NULL; - Ecore_Evas *ee = - ecore_evas_buffer_new(w, h); - Evas *evas = ecore_evas_get(ee); - - Evas_Object *img = NULL; - img = evas_object_image_add(evas); - - if (img == NULL) { - printf("image object is NULL\n"); - ecore_evas_free(ee); - ecore_evas_shutdown(); - 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 (!is_bgra) { - unsigned char *m = NULL; - m = evas_object_image_data_get(img, 1); -#if 1 /* Use self-logic to convert from RGB888 to RGBA */ - int i = 0, j; - for (j = 0; j < w * 3 * h; - j += 3) { - m[i++] = (data[j + 2]); - m[i++] = (data[j + 1]); - m[i++] = (data[j]); - m[i++] = 0x0; - } - -#else /* Use mmf api to convert from RGB888 to RGBA */ - int mm_ret = 0; - if ((mm_ret = - mm_util_convert_colorspace(data, - w, - h, - MM_UTIL_IMG_FMT_RGB888, - m, - MM_UTIL_IMG_FMT_BGRA8888)) - < 0) { - printf - ("Failed to change from rgb888 to argb8888 %d\n", - mm_ret); + gdk_pixbuf_save(data,"/mnt/nfs/test.jpg","jpeg", &error, NULL); + if (error) { + thumb_dbg ("Error saving image file /mnt/nfs/test.jpg "); + g_error_free (error); return -1; } -#endif /* End of use mmf api to convert from RGB888 to RGBA */ - - evas_object_image_data_set(img, m); - evas_object_image_data_update_add(img, 0, 0, w, h); - } else { - evas_object_image_data_set(img, data); - evas_object_image_data_update_add(img, 0, 0, w, h); - } - - if (evas_object_image_save - (img, "/mnt/nfs/test.jpg", NULL, - "quality=50 compress=2")) { - printf("evas_object_image_save success\n"); - } else { - printf("evas_object_image_save failed\n"); - } - - ecore_evas_shutdown(); - return 0; } @@ -123,7 +62,7 @@ int main(int argc, char *argv[]) if (origin_path && (mode == 1)) { printf("Test _thumbnail_get_data\n"); - unsigned char *data = NULL; + GdkPixbuf *data = NULL; int thumb_size = 0; int thumb_w = 0; int thumb_h = 0; @@ -149,7 +88,7 @@ int main(int argc, char *argv[]) printf("Size : %d, W:%d, H:%d\n", thumb_size, thumb_w, thumb_h); printf("Origin W:%d, Origin H:%d\n", origin_w, origin_h); - err = save_to_file_with_evas(data, thumb_w, thumb_h, is_bgra); + err = save_to_file_with_gdk(data, thumb_w, thumb_h, is_bgra); if (err < 0) { printf("_thumbnail_get_data failed - %d\n", err); return -1; -- cgit v1.2.3