From 57ba97391281a98c0acd5e2dc9df9c14e43b2f61 Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Mon, 11 Jul 2016 13:22:00 +0300 Subject: [PATCH] TSAM-6165 Preview wallpaper was white, can not preview this wallpaper Change-Id: I03bc37a19b19491851e44f0226c4c68284eec6b4 Signed-off-by: Denis Dolzhenko --- inc/wallpaper-ui-service.h | 1 + src/wallpaper-ui-service-main.c | 13 ++++++++----- src/wallpaper-ui-service.c | 15 ++++++++++----- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/inc/wallpaper-ui-service.h b/inc/wallpaper-ui-service.h index 870a8aa..c953dcb 100644 --- a/inc/wallpaper-ui-service.h +++ b/inc/wallpaper-ui-service.h @@ -173,6 +173,7 @@ char *wallpaper_ui_service_get_icon_path(const char *fileName); char *wallpaper_ui_service_get_edj_path(const char *fileName); const char *wallpaper_ui_service_get_settings_wallpapers_path(); const char *get_working_dir(); +int get_max_prescale_img_size(wallpaper_ui_service_appdata *app); #endif diff --git a/src/wallpaper-ui-service-main.c b/src/wallpaper-ui-service-main.c index 7daa44a..fa067fc 100644 --- a/src/wallpaper-ui-service-main.c +++ b/src/wallpaper-ui-service-main.c @@ -972,14 +972,12 @@ void _set_wallpaper(char *path) /* lockscreen */ if (system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, path) != SYSTEM_SETTINGS_ERROR_NONE) { WALLPAPERUI_ERR("Lockscreen set Error : %s", path); - elm_exit(); return; } /* homescreen */ if (system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, path) != SYSTEM_SETTINGS_ERROR_NONE) { WALLPAPERUI_ERR("Homescreen set Error : %s", path); - elm_exit(); return; } @@ -1082,7 +1080,6 @@ static void _done_to_set_wallpaper() if (ad->preview_image_type == WALLPAPER_TYPE_GALLERY) { WALLPAPERUI_DBG("SCALE start!"); - elm_win_lower(ad->win); _lockscreen_gallery_scale_job_maker(480, 800, 0); } else { _lockscreen_gallery_destroy_func(); @@ -1126,6 +1123,7 @@ static void _wallpaper_destroy(void *data) if (ad->last_preview_img_path != NULL) { WALLPAPERUI_ERR("free last_preview_img_path"); free(ad->last_preview_img_path); + ad->last_preview_img_path = NULL; } if (ad->win) { evas_object_del(ad->win); @@ -1135,8 +1133,7 @@ static void _wallpaper_destroy(void *data) char *edj = wallpaper_ui_service_get_edj_path("button_customized_theme.edj"); elm_theme_extension_del(NULL, edj); free(edj); - - elm_exit(); + ui_app_exit(); WALLPAPERUI_TRACE_END } @@ -1239,6 +1236,8 @@ static void _wallpaper_preview_main() WALLPAPERUI_DBG("current_preview_img_path = %s", ad->current_preview_img_path); + int prescale_size = get_max_prescale_img_size(ad); + elm_image_prescale_set(preview_image, prescale_size); elm_image_file_set(preview_image, ad->current_preview_img_path, NULL); elm_image_aspect_fixed_set(preview_image, EINA_TRUE); elm_image_fill_outside_set(preview_image, EINA_TRUE); @@ -1302,6 +1301,8 @@ HAPI void wallpaper_main_create_view(void *data) /* preview image */ Evas_Object *image = elm_image_add(preveiw_main_layout); + int prescale_size = get_max_prescale_img_size(ad); + elm_image_prescale_set(image, prescale_size); elm_image_file_set(image, value, NULL); elm_image_aspect_fixed_set(image, EINA_TRUE); elm_image_fill_outside_set(image, EINA_TRUE); @@ -1374,6 +1375,8 @@ static Evas_Object *_preview_create_edje_content(Evas_Object *parent, const char evas_object_show(layout); Evas_Object *image = elm_image_add(layout); + int prescale_size = get_max_prescale_img_size(ad); + elm_image_prescale_set(image, prescale_size); elm_object_part_content_set(layout, "item", image); elm_image_file_set(image, path, NULL); diff --git a/src/wallpaper-ui-service.c b/src/wallpaper-ui-service.c index 884ffde..5fc4dbb 100644 --- a/src/wallpaper-ui-service.c +++ b/src/wallpaper-ui-service.c @@ -138,7 +138,6 @@ static bool _wallpaper_db_destroy(void) static void _del_win(void *data, Evas_Object *obj, void *event) { WALLPAPERUI_TRACE_BEGIN; - ui_app_exit(); } @@ -311,7 +310,7 @@ static void _home_button_clicked_cb(void *data, DBusMessage *msg) return; } WALLPAPERUI_ERR("Destroy wallpaper"); - elm_exit(); + ui_app_exit(); } WALLPAPERUI_TRACE_END; @@ -440,7 +439,7 @@ void *_register_view(app_control_h service, void *data) if (file_name == NULL) { WALLPAPERUI_ERR("CIRITICAL ERROR : wallpaper file is NULL"); - elm_exit(); + ui_app_exit(); return NULL; } } @@ -448,7 +447,6 @@ void *_register_view(app_control_h service, void *data) free(file_name); if (ad->color_popup_data.file_path == NULL) { WALLPAPERUI_ERR("CIRITICAL ERROR : strdup() failed"); -/* elm_exit(); */ } } @@ -488,7 +486,6 @@ static void _app_terminate(void *data) free(_g_wallpapersPath); free(_g_workingDirPath); feedback_deinitialize(); - elm_exit(); WALLPAPERUI_TRACE_END; } @@ -738,6 +735,14 @@ const char *get_working_dir() return _g_workingDirPath; } +int get_max_prescale_img_size(wallpaper_ui_service_appdata *app) +{ + int w = 0; + int h = 0; + evas_object_geometry_get(app->win, NULL, NULL, &w, &h); + return MAX(w, h); +} + /** * @} */ -- 2.7.4