summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-09-04 16:14:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit97d9fab7042f213498268dfc58636b823380245c (patch)
tree344ac20e4aa4854d23dba9f7afada5b6a2759e65
parentbfe3fe27df9384642d8f3b277ec694c9d42fc0c9 (diff)
evas/cserve2: Fallback to normal cache for animated gifs
Pass around "animated" flag for images that can be animated. Fallback to local cache if the image is animated. Implementing support for animated images in cserve2 does not seem to make a lot of sense considering each frame must be requested independently in real time,... and to be honest there doesn't seem to be any valid use case anyway :)
-rw-r--r--src/bin/evas/evas_cserve2_cache.c2
-rw-r--r--src/bin/evas/evas_cserve2_shm_debug.c3
-rw-r--r--src/lib/evas/cache2/evas_cache2.c3
-rw-r--r--src/lib/evas/cserve2/evas_cs2.h2
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c9
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c24
6 files changed, 38 insertions, 5 deletions
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 40cd55df4b..83923d48c9 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -444,6 +444,7 @@ _image_opened_msg_create(File_Data *fd, int *size)
444 msg->image.loop_count = fd->loop_count; 444 msg->image.loop_count = fd->loop_count;
445 msg->image.loop_hint = fd->loop_hint; 445 msg->image.loop_hint = fd->loop_hint;
446 msg->image.alpha = fd->alpha; 446 msg->image.alpha = fd->alpha;
447 msg->image.animated = fd->animated;
447 448
448 *size = sizeof(*msg); 449 *size = sizeof(*msg);
449 450
@@ -615,6 +616,7 @@ _open_request_response(Entry *entry, Slave_Msg_Image_Opened *resp, int *size)
615 616
616 fd->w = resp->w; 617 fd->w = resp->w;
617 fd->h = resp->h; 618 fd->h = resp->h;
619 fd->animated = resp->animated;
618 fd->frame_count = resp->frame_count; 620 fd->frame_count = resp->frame_count;
619 fd->loop_count = resp->loop_count; 621 fd->loop_count = resp->loop_count;
620 fd->loop_hint = resp->loop_hint; 622 fd->loop_hint = resp->loop_hint;
diff --git a/src/bin/evas/evas_cserve2_shm_debug.c b/src/bin/evas/evas_cserve2_shm_debug.c
index 426fd67a95..49bae201f0 100644
--- a/src/bin/evas/evas_cserve2_shm_debug.c
+++ b/src/bin/evas/evas_cserve2_shm_debug.c
@@ -519,7 +519,8 @@ _images_all_print_full(void)
519 printf(" Loader: %s\n", 519 printf(" Loader: %s\n",
520 _shared_string_get(fd->loader_data)); 520 _shared_string_get(fd->loader_data));
521 printf(" Geometry: %dx%d\n", fd->w, fd->h); 521 printf(" Geometry: %dx%d\n", fd->w, fd->h);
522 printf(" Animation: frames: %d, loop: %d, hint: %d\n", 522 printf(" Animation: anim: %s, frames: %d, loop: %d, hint: %d\n",
523 fd->animated ? "YES" : "NO",
523 fd->frame_count, fd->loop_count, fd->loop_hint); 524 fd->frame_count, fd->loop_count, fd->loop_hint);
524 printf(" Alpha: %s\n", fd->alpha ? "YES" : "NO"); 525 printf(" Alpha: %s\n", fd->alpha ? "YES" : "NO");
525 printf(" Invalid: %s\n", fd->invalid ? "YES" : "NO"); 526 printf(" Invalid: %s\n", fd->invalid ? "YES" : "NO");
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index 4b51b3292e..0444741289 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -873,6 +873,9 @@ evas_cache2_image_scale_load(Image_Entry *im,
873 int error = EVAS_LOAD_ERROR_NONE; 873 int error = EVAS_LOAD_ERROR_NONE;
874 Image_Entry *ret; 874 Image_Entry *ret;
875 875
876 if (!im->cache2)
877 return im;
878
876 if (!smooth && im->scale_hint != EVAS_IMAGE_SCALE_HINT_STATIC) 879 if (!smooth && im->scale_hint != EVAS_IMAGE_SCALE_HINT_STATIC)
877 goto parent_out; 880 goto parent_out;
878 881
diff --git a/src/lib/evas/cserve2/evas_cs2.h b/src/lib/evas/cserve2/evas_cs2.h
index a47c384b82..835ed31c0b 100644
--- a/src/lib/evas/cserve2/evas_cs2.h
+++ b/src/lib/evas/cserve2/evas_cs2.h
@@ -73,6 +73,7 @@ struct _Msg_Opened {
73 int loop_count; 73 int loop_count;
74 int loop_hint; /* include Evas.h? Copy the enum around? */ 74 int loop_hint; /* include Evas.h? Copy the enum around? */
75 Eina_Bool alpha : 1; 75 Eina_Bool alpha : 1;
76 Eina_Bool animated : 1;
76 } image; 77 } image;
77}; 78};
78 79
@@ -333,6 +334,7 @@ struct _File_Data {
333 Eina_Bool alpha : 1; 334 Eina_Bool alpha : 1;
334 Eina_Bool invalid : 1; 335 Eina_Bool invalid : 1;
335 Eina_Bool valid : 1; 336 Eina_Bool valid : 1;
337 Eina_Bool animated : 1;
336}; 338};
337 339
338#define IMAGE_DATA_ARRAY_TAG ('I' | 'M' << 8 | 'A' << 16 | 'G' << 24) 340#define IMAGE_DATA_ARRAY_TAG ('I' | 'M' << 8 | 'A' << 16 | 'G' << 24)
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 852ae08640..566bd0655a 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -505,6 +505,7 @@ _image_opened_cb(void *data, const void *msg_received, int size)
505 ie->animated.loop_hint = msg->image.loop_hint; 505 ie->animated.loop_hint = msg->image.loop_hint;
506 ie->animated.loop_count = msg->image.loop_count; 506 ie->animated.loop_count = msg->image.loop_count;
507 ie->animated.frame_count = msg->image.frame_count; 507 ie->animated.frame_count = msg->image.frame_count;
508 ie->animated.animated = msg->image.animated;
508} 509}
509 510
510static void 511static void
@@ -985,9 +986,9 @@ evas_cserve2_image_load_wait(Image_Entry *ie)
985 ie->animated.loop_hint = fd->loop_hint; 986 ie->animated.loop_hint = fd->loop_hint;
986 ie->animated.loop_count = fd->loop_count; 987 ie->animated.loop_count = fd->loop_count;
987 ie->animated.frame_count = fd->frame_count; 988 ie->animated.frame_count = fd->frame_count;
989 ie->animated.animated = fd->animated;
988 ie->server_id = fd->id; 990 ie->server_id = fd->id;
989 ie->open_rid = 0; 991 ie->open_rid = 0;
990 return CSERVE2_NONE;
991 } 992 }
992#endif 993#endif
993 994
@@ -999,6 +1000,12 @@ evas_cserve2_image_load_wait(Image_Entry *ie)
999 return CSERVE2_GENERIC; 1000 return CSERVE2_GENERIC;
1000 } 1001 }
1001 1002
1003 if (ie->animated.animated)
1004 {
1005 WRN("This image is animated. cserve2 does not support animations");
1006 return CSERVE2_GENERIC;
1007 }
1008
1002 return CSERVE2_NONE; 1009 return CSERVE2_NONE;
1003} 1010}
1004 1011
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 8b3441444b..577d3af4b0 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -949,10 +949,19 @@ eng_image_load(void *data EINA_UNUSED, const char *file, const char *key, int *e
949 ie = evas_cache2_image_open(evas_common_image_cache2_get(), 949 ie = evas_cache2_image_open(evas_common_image_cache2_get(),
950 file, key, lo, error); 950 file, key, lo, error);
951 if (ie) 951 if (ie)
952 *error = evas_cache2_image_open_wait(ie); 952 {
953 *error = evas_cache2_image_open_wait(ie);
954 if ((*error != EVAS_LOAD_ERROR_NONE) && ie->animated.animated)
955 {
956 evas_cache2_image_close(ie);
957 goto use_local_cache;
958 }
959 }
953 return ie; 960 return ie;
954 } 961 }
962use_local_cache:
955#endif 963#endif
964
956 return evas_common_load_image_from_file(file, key, lo, error); 965 return evas_common_load_image_from_file(file, key, lo, error);
957} 966}
958 967
@@ -968,10 +977,19 @@ eng_image_mmap(void *data EINA_UNUSED, Eina_File *f, const char *key, int *error
968 ie = evas_cache2_image_open(evas_common_image_cache2_get(), 977 ie = evas_cache2_image_open(evas_common_image_cache2_get(),
969 eina_file_filename_get(f), key, lo, error); 978 eina_file_filename_get(f), key, lo, error);
970 if (ie) 979 if (ie)
971 *error = evas_cache2_image_open_wait(ie); 980 {
981 *error = evas_cache2_image_open_wait(ie);
982 if ((*error != EVAS_LOAD_ERROR_NONE) && ie->animated.animated)
983 {
984 evas_cache2_image_close(ie);
985 goto use_local_cache;
986 }
987 }
972 return ie; 988 return ie;
973 } 989 }
990use_local_cache:
974#endif 991#endif
992
975 return evas_common_load_image_from_mmap(f, key, lo, error); 993 return evas_common_load_image_from_mmap(f, key, lo, error);
976} 994}
977 995
@@ -1295,7 +1313,7 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
1295 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) 1313 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
1296 { 1314 {
1297#if EVAS_CSERVE2 1315#if EVAS_CSERVE2
1298 if (evas_cserve2_use_get()) 1316 if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
1299 evas_cache2_image_load_data(&im->cache_entry); 1317 evas_cache2_image_load_data(&im->cache_entry);
1300 else 1318 else
1301#endif 1319#endif