summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-11-19 19:06:18 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-11-19 19:07:19 +0900
commit42d2f8a12b4706b79e7cf16162d34f259bdc23d4 (patch)
tree12333c48993d9f6e2af98710d682bebffa696dee
parent9afe5ffb9dd7b9cf2ea151e2ae7f7e70724c5e62 (diff)
Evas: Set image load_error after load
In case of async preload, this avoids loading an image twice if it already failed loading. Thanks Minkyoung Kim for spotting this.
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 9e852bbced..4faf6b2cd2 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -762,6 +762,7 @@ void
762evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) 762evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
763{ 763{
764 Image_Entry *ie; 764 Image_Entry *ie;
765
765 if (!im->im) return; 766 if (!im->im) return;
766 ie = &im->im->cache_entry; 767 ie = &im->im->cache_entry;
767 evas_gl_common_image_alloc_ensure(im); 768 evas_gl_common_image_alloc_ensure(im);
@@ -808,33 +809,37 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
808#ifdef EVAS_CSERVE2 809#ifdef EVAS_CSERVE2
809 if (evas_cache2_image_cached(ie)) 810 if (evas_cache2_image_cached(ie))
810 { 811 {
811 evas_cache2_image_load_data(ie); 812 ie->load_error = evas_cache2_image_load_data(ie);
812 evas_gl_common_texture_update(im->tex, im->im); 813 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
814 evas_gl_common_texture_update(im->tex, im->im);
813 evas_cache2_image_unload_data(ie); 815 evas_cache2_image_unload_data(ie);
814 } 816 }
815 else 817 else
816#endif 818#endif
817 { 819 {
818 evas_cache_image_load_data(ie); 820 ie->load_error = evas_cache_image_load_data(ie);
819 evas_gl_common_texture_update(im->tex, im->im); 821 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
822 evas_gl_common_texture_update(im->tex, im->im);
820 evas_cache_image_unload_data(ie); 823 evas_cache_image_unload_data(ie);
821 } 824 }
822 ie->flags.updated_data = 0; 825 ie->flags.updated_data = 0;
823 } 826 }
824 if (!im->tex) 827 else if ((!im->tex) && (ie->load_error == EVAS_LOAD_ERROR_NONE))
825 { 828 {
826#ifdef EVAS_CSERVE2 829#ifdef EVAS_CSERVE2
827 if (evas_cache2_image_cached(ie)) 830 if (evas_cache2_image_cached(ie))
828 { 831 {
829 evas_cache2_image_load_data(ie); 832 ie->load_error = evas_cache2_image_load_data(ie);
830 im->tex = evas_gl_common_texture_new(gc, im->im); 833 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
834 im->tex = evas_gl_common_texture_new(gc, im->im);
831 evas_cache2_image_unload_data(ie); 835 evas_cache2_image_unload_data(ie);
832 } 836 }
833 else 837 else
834#endif 838#endif
835 { 839 {
836 evas_cache_image_load_data(ie); 840 ie->load_error = evas_cache_image_load_data(ie);
837 im->tex = evas_gl_common_texture_new(gc, im->im); 841 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
842 im->tex = evas_gl_common_texture_new(gc, im->im);
838 evas_cache_image_unload_data(ie); 843 evas_cache_image_unload_data(ie);
839 } 844 }
840 } 845 }
@@ -844,14 +849,16 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
844 case EVAS_COLORSPACE_ETC1_ALPHA: 849 case EVAS_COLORSPACE_ETC1_ALPHA:
845 if ((im->tex) && (im->dirty)) 850 if ((im->tex) && (im->dirty))
846 { 851 {
847 evas_cache_image_load_data(ie); 852 ie->load_error = evas_cache_image_load_data(ie);
848 evas_gl_common_texture_rgb_a_pair_update(im->tex, im->im); 853 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
854 evas_gl_common_texture_rgb_a_pair_update(im->tex, im->im);
849 evas_cache_image_unload_data(ie); 855 evas_cache_image_unload_data(ie);
850 } 856 }
851 else if ((!im->tex)) 857 else if ((!im->tex) && (ie->load_error == EVAS_LOAD_ERROR_NONE))
852 { 858 {
853 evas_cache_image_load_data(ie); 859 ie->load_error = evas_cache_image_load_data(ie);
854 im->tex = evas_gl_common_texture_rgb_a_pair_new(gc, im->im); 860 if (ie->load_error == EVAS_LOAD_ERROR_NONE)
861 im->tex = evas_gl_common_texture_rgb_a_pair_new(gc, im->im);
855 evas_cache_image_unload_data(ie); 862 evas_cache_image_unload_data(ie);
856 } 863 }
857 im->dirty = 0; 864 im->dirty = 0;