summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-09-23 17:51:06 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit1e82480c9a074163ec6788a8a60ead403f7b0658 (patch)
tree0c1458c5a0a0149c0f4a16e11f4d3523934cdb74 /src/lib/evas
parentfc73405c40653a5fc0166690e3657ffd87069efc (diff)
evas/cserve2: Use scalecache with cserve2
Let's reuse the logic from scalecache and call cserve2 functions when the scalecache should be used. So, now, cserve2 server will not scale any image... This is too computationally intensive for the server's main thread. This is not optimal but makes a hell of a lot more sense for the moment. (since cserve2 manages the SHM segments)
Diffstat (limited to '')
-rw-r--r--src/lib/evas/cache2/evas_cache2.c3
-rw-r--r--src/lib/evas/canvas/evas_object_image.c56
-rw-r--r--src/lib/evas/common/evas_image_scalecache.c20
-rw-r--r--src/lib/evas/cserve2/evas_cs2.h4
4 files changed, 35 insertions, 48 deletions
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index fc7982d5ba..b6b1eadd1f 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -799,7 +799,8 @@ evas_cache2_image_open_wait(Image_Entry *im)
799} 799}
800 800
801static Image_Entry * 801static Image_Entry *
802_scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h, int dst_w, int dst_h, int smooth) 802_scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
803 int src_h, int dst_w, int dst_h, int smooth)
803{ 804{
804 size_t pathlen, keylen, size; 805 size_t pathlen, keylen, size;
805 char *hkey; 806 char *hkey;
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 5178e1b1a7..4e5cd3d391 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -3998,53 +3998,15 @@ evas_object_image_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, v
3998 (o->cur->border.b == 0) && 3998 (o->cur->border.b == 0) &&
3999 (o->cur->border.fill != 0)) 3999 (o->cur->border.fill != 0))
4000 { 4000 {
4001#ifdef EVAS_CSERVE2 4001 _draw_image
4002 if (evas_cserve2_use_get()) 4002 (obj, output, context, surface, pixels,
4003 { 4003 0, 0,
4004 Image_Entry *ie; 4004 imagew, imageh,
4005 void *data = pixels; 4005 obj->cur->geometry.x + ix + x,
4006 int w = imagew, h = imageh; 4006 obj->cur->geometry.y + iy + y,
4007 Eina_Bool mustclose = EINA_FALSE; 4007 iw, ih,
4008 4008 o->cur->smooth_scale,
4009 ie = evas_cache2_image_scale_load 4009 do_async);
4010 ((Image_Entry *)pixels,
4011 0, 0,
4012 imagew, imageh,
4013 iw, ih, o->cur->smooth_scale);
4014 if (ie != &((RGBA_Image *)pixels)->cache_entry)
4015 {
4016 data = ie;
4017 w = iw;
4018 h = ih;
4019 mustclose = EINA_TRUE;
4020 }
4021
4022 _draw_image
4023 (obj, output, context, surface, data,
4024 0, 0,
4025 w, h,
4026 obj->cur->geometry.x + ix + x,
4027 obj->cur->geometry.y + iy + y,
4028 iw, ih,
4029 o->cur->smooth_scale,
4030 do_async);
4031
4032 if (mustclose)
4033 evas_cache2_image_close(ie);
4034 }
4035 else
4036#endif
4037 {
4038 _draw_image
4039 (obj, output, context, surface, pixels,
4040 0, 0,
4041 imagew, imageh,
4042 obj->cur->geometry.x + ix + x,
4043 obj->cur->geometry.y + iy + y,
4044 iw, ih,
4045 o->cur->smooth_scale,
4046 do_async);
4047 }
4048 } 4010 }
4049 else 4011 else
4050 { 4012 {
diff --git a/src/lib/evas/common/evas_image_scalecache.c b/src/lib/evas/common/evas_image_scalecache.c
index fc907614c8..3802f0cce5 100644
--- a/src/lib/evas/common/evas_image_scalecache.c
+++ b/src/lib/evas/common/evas_image_scalecache.c
@@ -759,6 +759,26 @@ evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
759 } 759 }
760 } 760 }
761 } 761 }
762
763#ifdef EVAS_CSERVE2
764 if (sci->populate_me && (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
765 && evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
766 {
767 RGBA_Image *im2 = (RGBA_Image *) evas_cache2_image_scale_load
768 (&im->cache_entry, src_region_x, src_region_y,
769 src_region_w, src_region_h, dst_region_w, dst_region_h, smooth);
770 SLKL(cache_lock);
771 if (im2 != im)
772 {
773 sci->im = im2;
774 sci->populate_me = 0;
775 cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
776 didpop = 1;
777 }
778 SLKU(cache_lock);
779 }
780#endif
781
762 if (sci->populate_me) 782 if (sci->populate_me)
763 { 783 {
764// INF("##! populate!"); 784// INF("##! populate!");
diff --git a/src/lib/evas/cserve2/evas_cs2.h b/src/lib/evas/cserve2/evas_cs2.h
index 6cc8804e29..5378790999 100644
--- a/src/lib/evas/cserve2/evas_cs2.h
+++ b/src/lib/evas/cserve2/evas_cs2.h
@@ -90,6 +90,9 @@ struct _Msg_Loaded {
90 int mmap_size; 90 int mmap_size;
91 int image_size; 91 int image_size;
92 } shm; 92 } shm;
93 struct {
94 unsigned int w, h; // Real dimensions of this image. May differ from Msg_Opened::image::{w,h} after scaling.
95 } image;
93 Eina_Bool alpha_sparse : 1; 96 Eina_Bool alpha_sparse : 1;
94}; 97};
95 98
@@ -354,6 +357,7 @@ struct _Image_Data {
354 uint32_t file_id; 357 uint32_t file_id;
355 string_t shm_id; 358 string_t shm_id;
356 Evas_Image_Load_Opts opts; 359 Evas_Image_Load_Opts opts;
360 uint32_t w, h;
357 Eina_Bool alpha_sparse : 1; 361 Eina_Bool alpha_sparse : 1;
358 Eina_Bool unused : 1; 362 Eina_Bool unused : 1;
359 Eina_Bool doload : 1; 363 Eina_Bool doload : 1;