summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-27 23:44:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-27 23:44:02 +0900
commitacf8988c40694c3c8b99f3f113baab73efd22c48 (patch)
tree35e5bf5f7a9f752ae7f4fd80fe38bb6246224bd5
parentbcbc26371076f8580c7ff5dc937131e4a1f19d62 (diff)
e widget bgpreview - use e thumb to get quality back and speed too
this should keep the perfromance of the prior commit f80f73a7c9cf663ccb3db9634a72d7fcc294bd90 and now get quality back by generating thumbnails at higher resolution then scaling down from there. @fix
-rw-r--r--src/bin/e_widget_bgpreview.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/bin/e_widget_bgpreview.c b/src/bin/e_widget_bgpreview.c
index f66eb8063..89be7427a 100644
--- a/src/bin/e_widget_bgpreview.c
+++ b/src/bin/e_widget_bgpreview.c
@@ -10,11 +10,12 @@ struct _E_Widget_Data
10typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data; 10typedef struct _E_Widget_Desk_Data E_Widget_Desk_Data;
11struct _E_Widget_Desk_Data 11struct _E_Widget_Desk_Data
12{ 12{
13 Evas_Object *icon, *thumb, *live, *cont; 13 Evas_Object *icon, *live, *cont;
14 int zone, x, y; 14 int zone, x, y;
15 Ecore_Event_Handler *bg_upd_hdl; 15 Ecore_Event_Handler *bg_upd_hdl;
16 Ecore_Job *resize_job; 16 Ecore_Job *resize_job;
17 Eina_Bool configurable : 1; 17 Eina_Bool configurable : 1;
18 Eina_Bool thumb : 1;
18}; 19};
19 20
20/* local function prototypes */ 21/* local function prototypes */
@@ -26,6 +27,7 @@ static void _e_wid_desk_cb_config(void *data, Evas *evas, Evas_Object *obj,
26static void _e_wid_cb_resize(void *data, Evas *evas, Evas_Object *obj, void *event); 27static void _e_wid_cb_resize(void *data, Evas *evas, Evas_Object *obj, void *event);
27static Eina_Bool _e_wid_cb_bg_update(void *data, int type, void *event); 28static Eina_Bool _e_wid_cb_bg_update(void *data, int type, void *event);
28 29
30/*
29static void 31static void
30_bgpreview_viewport_update(Evas_Object *o, const E_Zone *zone, int x, int y) 32_bgpreview_viewport_update(Evas_Object *o, const E_Zone *zone, int x, int y)
31{ 33{
@@ -40,6 +42,7 @@ _bgpreview_viewport_update(Evas_Object *o, const E_Zone *zone, int x, int y)
40 msg->val[4] = zone->desk_y_count; 42 msg->val[4] = zone->desk_y_count;
41 edje_object_message_send(o, EDJE_MESSAGE_FLOAT_SET, 0, msg); 43 edje_object_message_send(o, EDJE_MESSAGE_FLOAT_SET, 0, msg);
42} 44}
45*/
43 46
44E_API Evas_Object * 47E_API Evas_Object *
45e_widget_bgpreview_add(Evas *evas, int nx, int ny) 48e_widget_bgpreview_add(Evas *evas, int nx, int ny)
@@ -96,14 +99,16 @@ e_widget_bgpreview_desk_add(Evas *e, E_Zone *zone, int x, int y)
96 99
97 dd->cont = evas_object_table_add(e); 100 dd->cont = evas_object_table_add(e);
98 101
102 dd->thumb = EINA_FALSE;
99 if (eina_str_has_extension(bgfile, ".edj")) 103 if (eina_str_has_extension(bgfile, ".edj"))
100 { 104 {
101 dd->live = e_livethumb_add(e); 105 dd->live = o = e_thumb_icon_add(e);
102 dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live)); 106 e_thumb_icon_size_set(o, zone->w / 8, zone->h / 8);
103 edje_object_file_set(o, bgfile, "e/desktop/background"); 107 e_thumb_icon_file_set(o, bgfile, "e/desktop/background");
104 _bgpreview_viewport_update(o, zone, x, y); 108 e_icon_fill_inside_set(o, EINA_FALSE);
105 e_livethumb_thumb_set(dd->live, o); 109 e_thumb_icon_begin(o);
106 evas_object_show(dd->thumb); 110// _bgpreview_viewport_update(o, zone, x, y);
111 dd->thumb = EINA_TRUE;
107 } 112 }
108 else if ((eina_str_has_extension(bgfile, ".gif")) || 113 else if ((eina_str_has_extension(bgfile, ".gif")) ||
109 (eina_str_has_extension(bgfile, ".png")) || 114 (eina_str_has_extension(bgfile, ".png")) ||
@@ -165,6 +170,9 @@ _e_wid_livethumb_resize_job(void *data)
165 170
166 if (dd->thumb) 171 if (dd->thumb)
167 { 172 {
173 const char *bgfile;
174
175 bgfile = e_bg_file_get(dd->zone, dd->x, dd->y);
168 zone = e_comp_object_util_zone_get(dd->live); 176 zone = e_comp_object_util_zone_get(dd->live);
169 if (!zone) zone = eina_list_data_get(e_comp->zones); 177 if (!zone) zone = eina_list_data_get(e_comp->zones);
170 evas_object_geometry_get(dd->cont, NULL, NULL, &w, &h); 178 evas_object_geometry_get(dd->cont, NULL, NULL, &w, &h);
@@ -183,7 +191,10 @@ _e_wid_livethumb_resize_job(void *data)
183 w = (zone->w * h) / zone->h; 191 w = (zone->w * h) / zone->h;
184 } 192 }
185 } 193 }
186 e_livethumb_vsize_set(dd->live, w, h); 194 e_thumb_icon_size_set(dd->live, w, h);
195 e_thumb_icon_file_set(dd->live, bgfile, "e/desktop/background");
196 e_icon_fill_inside_set(dd->live, EINA_FALSE);
197 e_thumb_icon_rethumb(dd->live);
187 } 198 }
188 dd->resize_job = NULL; 199 dd->resize_job = NULL;
189} 200}
@@ -359,19 +370,20 @@ _e_wid_cb_bg_update(void *data, int type, void *event)
359 zone = e_comp_zone_number_get(dd->zone); 370 zone = e_comp_zone_number_get(dd->zone);
360 bgfile = e_bg_file_get(dd->zone, dd->x, dd->y); 371 bgfile = e_bg_file_get(dd->zone, dd->x, dd->y);
361 372
362 if (dd->thumb) evas_object_del(dd->thumb);
363 dd->thumb = NULL;
364 if (dd->live) evas_object_del(dd->live); 373 if (dd->live) evas_object_del(dd->live);
365 dd->live = NULL; 374 dd->live = NULL;
366 375
376 dd->thumb = EINA_FALSE;
367 if (eina_str_has_extension(bgfile, ".edj")) 377 if (eina_str_has_extension(bgfile, ".edj"))
368 { 378 {
369 dd->live = e_livethumb_add(e); 379 dd->live = o = e_thumb_icon_add(e);
370 dd->thumb = o = edje_object_add(e_livethumb_evas_get(dd->live)); 380 e_thumb_icon_size_set(o, zone->w / 8, zone->h / 8);
371 edje_object_file_set(o, bgfile, "e/desktop/background"); 381 e_thumb_icon_file_set(o, bgfile, "e/desktop/background");
372 _bgpreview_viewport_update(o, zone, dd->x, dd->y); 382 e_icon_fill_inside_set(o, EINA_FALSE);
373 e_livethumb_thumb_set(dd->live, o); 383 e_thumb_icon_begin(o);
374 evas_object_show(dd->thumb); 384// _bgpreview_viewport_update(o, zone, dd->x, dd->y);
385 dd->thumb = EINA_TRUE;
386 _e_wid_livethumb_resize_job(dd);
375 } 387 }
376 else if ((eina_str_has_extension(bgfile, ".gif")) || 388 else if ((eina_str_has_extension(bgfile, ".gif")) ||
377 (eina_str_has_extension(bgfile, ".png")) || 389 (eina_str_has_extension(bgfile, ".png")) ||
@@ -387,7 +399,6 @@ _e_wid_cb_bg_update(void *data, int type, void *event)
387 { 399 {
388 dd->live = o = e_video_add(e, bgfile, EINA_TRUE); 400 dd->live = o = e_video_add(e, bgfile, EINA_TRUE);
389 } 401 }
390 _e_wid_livethumb_resize_job(dd);
391 eina_stringshare_del(bgfile); 402 eina_stringshare_del(bgfile);
392 403
393 evas_object_size_hint_weight_set(dd->live, 1, 1); 404 evas_object_size_hint_weight_set(dd->live, 1, 1);