summaryrefslogtreecommitdiff
path: root/legacy/evas
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-10-09 07:49:07 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-10-09 07:49:07 +0000
commit457b24043438c475981df7ca8d8a2e93128e5fa6 (patch)
treeda282b5c26ee2184e5b05e8eb72967d41e2af4ae /legacy/evas
parent16e6b9fce572e55bef6d3ce5616ef3caee114770 (diff)
evas: do less request to eo.
SVN revision: 77617
Diffstat (limited to 'legacy/evas')
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_image.c181
-rw-r--r--legacy/evas/src/lib/include/evas_private.h2
2 files changed, 117 insertions, 66 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_object_image.c b/legacy/evas/src/lib/canvas/evas_object_image.c
index f19c4201ca..0063f1be62 100644
--- a/legacy/evas/src/lib/canvas/evas_object_image.c
+++ b/legacy/evas/src/lib/canvas/evas_object_image.c
@@ -53,8 +53,6 @@ struct _Evas_Object_Image
53 53
54 unsigned char smooth_scale : 1; 54 unsigned char smooth_scale : 1;
55 unsigned char has_alpha :1; 55 unsigned char has_alpha :1;
56 unsigned char opaque :1;
57 unsigned char opaque_valid :1;
58 } cur, prev; 56 } cur, prev;
59 57
60 int pixels_checked_out; 58 int pixels_checked_out;
@@ -156,9 +154,9 @@ static const Evas_Object_Func object_func =
156}; 154};
157 155
158static void 156static void
159_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Image *o) 157_evas_object_image_cleanup(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object_Image *o)
160{ 158{
161 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 159 obj->cur.opaque_valid = 0;
162 if ((o->preloading) && (o->engine_data)) 160 if ((o->preloading) && (o->engine_data))
163 { 161 {
164 o->preloading = EINA_FALSE; 162 o->preloading = EINA_FALSE;
@@ -518,7 +516,7 @@ _image_source_set(Eo *eo_obj, void *_pd, va_list *list)
518 return; 516 return;
519 } 517 }
520 518
521 _evas_object_image_cleanup(eo_obj, o); 519 _evas_object_image_cleanup(eo_obj, obj, o);
522 /* Kill the image if any */ 520 /* Kill the image if any */
523 if (o->cur.file || o->cur.key) 521 if (o->cur.file || o->cur.key)
524 evas_object_image_file_set(eo_obj, NULL, NULL); 522 evas_object_image_file_set(eo_obj, NULL, NULL);
@@ -589,7 +587,6 @@ _image_border_set(Eo *eo_obj, void *_pd, va_list *list)
589 o->cur.border.r = r; 587 o->cur.border.r = r;
590 o->cur.border.t = t; 588 o->cur.border.t = t;
591 o->cur.border.b = b; 589 o->cur.border.b = b;
592 o->cur.opaque_valid = 0;
593 o->changed = EINA_TRUE; 590 o->changed = EINA_TRUE;
594 evas_object_change(eo_obj, obj); 591 evas_object_change(eo_obj, obj);
595} 592}
@@ -769,6 +766,7 @@ evas_object_image_fill_set(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y, Evas
769static void 766static void
770_image_fill_set(Eo *eo_obj, void *_pd, va_list *list) 767_image_fill_set(Eo *eo_obj, void *_pd, va_list *list)
771{ 768{
769 Evas_Object_Protected_Data *obj;
772 Evas_Object_Image *o = _pd; 770 Evas_Object_Image *o = _pd;
773 771
774 Evas_Coord x = va_arg(*list, Evas_Coord); 772 Evas_Coord x = va_arg(*list, Evas_Coord);
@@ -789,9 +787,9 @@ _image_fill_set(Eo *eo_obj, void *_pd, va_list *list)
789 o->cur.fill.y = y; 787 o->cur.fill.y = y;
790 o->cur.fill.w = w; 788 o->cur.fill.w = w;
791 o->cur.fill.h = h; 789 o->cur.fill.h = h;
792 o->cur.opaque_valid = 0;
793 o->changed = EINA_TRUE; 790 o->changed = EINA_TRUE;
794 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 791 obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
792 obj->cur.opaque_valid = 0;
795 evas_object_change(eo_obj, obj); 793 evas_object_change(eo_obj, obj);
796} 794}
797 795
@@ -877,13 +875,14 @@ evas_object_image_size_set(Evas_Object *eo_obj, int w, int h)
877static void 875static void
878_image_size_set(Eo *eo_obj, void *_pd, va_list *list) 876_image_size_set(Eo *eo_obj, void *_pd, va_list *list)
879{ 877{
878 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
880 int w = va_arg(*list, int); 879 int w = va_arg(*list, int);
881 int h = va_arg(*list, int); 880 int h = va_arg(*list, int);
882 881
883 Evas_Object_Image *o = _pd; 882 Evas_Object_Image *o = _pd;
884 int stride = 0; 883 int stride = 0;
885 884
886 _evas_object_image_cleanup(eo_obj, o); 885 _evas_object_image_cleanup(eo_obj, obj, o);
887 if (w < 1) w = 1; 886 if (w < 1) w = 1;
888 if (h < 1) h = 1; 887 if (h < 1) h = 1;
889 if (w > 32768) return; 888 if (w > 32768) return;
@@ -892,7 +891,7 @@ _image_size_set(Eo *eo_obj, void *_pd, va_list *list)
892 (h == o->cur.image.h)) return; 891 (h == o->cur.image.h)) return;
893 o->cur.image.w = w; 892 o->cur.image.w = w;
894 o->cur.image.h = h; 893 o->cur.image.h = h;
895 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 894
896 if (o->engine_data) 895 if (o->engine_data)
897 o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output, o->engine_data, w, h); 896 o->engine_data = obj->layer->evas->engine.func->image_size_set(obj->layer->evas->engine.data.output, o->engine_data, w, h);
898 else 897 else
@@ -1053,7 +1052,7 @@ _image_data_set(Eo *eo_obj, void *_pd, va_list *list)
1053 1052
1054 void *data = va_arg(*list, void *); 1053 void *data = va_arg(*list, void *);
1055 1054
1056 _evas_object_image_cleanup(eo_obj, o); 1055 _evas_object_image_cleanup(eo_obj, obj, o);
1057 p_data = o->engine_data; 1056 p_data = o->engine_data;
1058 if (data) 1057 if (data)
1059 { 1058 {
@@ -1250,14 +1249,14 @@ evas_object_image_data_copy_set(Evas_Object *eo_obj, void *data)
1250static void 1249static void
1251_image_data_copy_set(Eo *eo_obj, void *_pd, va_list *list) 1250_image_data_copy_set(Eo *eo_obj, void *_pd, va_list *list)
1252{ 1251{
1252 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
1253 Evas_Object_Image *o = _pd; 1253 Evas_Object_Image *o = _pd;
1254 void *data = va_arg(*list, void *); 1254 void *data = va_arg(*list, void *);
1255 1255
1256 if (!data) return; 1256 if (!data) return;
1257 _evas_object_image_cleanup(eo_obj, o); 1257 _evas_object_image_cleanup(eo_obj, obj, o);
1258 if ((o->cur.image.w <= 0) || 1258 if ((o->cur.image.w <= 0) ||
1259 (o->cur.image.h <= 0)) return; 1259 (o->cur.image.h <= 0)) return;
1260 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
1261 if (o->engine_data) 1260 if (o->engine_data)
1262 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, 1261 obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output,
1263 o->engine_data); 1262 o->engine_data);
@@ -1565,15 +1564,16 @@ evas_object_image_pixels_import(Evas_Object *eo_obj, Evas_Pixel_Import_Source *p
1565static void 1564static void
1566_image_pixels_import(Eo *eo_obj, void *_pd, va_list *list) 1565_image_pixels_import(Eo *eo_obj, void *_pd, va_list *list)
1567{ 1566{
1567 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
1568 Evas_Object_Image *o = _pd; 1568 Evas_Object_Image *o = _pd;
1569 1569
1570 Evas_Pixel_Import_Source *pixels = va_arg(*list, Evas_Pixel_Import_Source *); 1570 Evas_Pixel_Import_Source *pixels = va_arg(*list, Evas_Pixel_Import_Source *);
1571 Eina_Bool *result = va_arg(*list, Eina_Bool *); 1571 Eina_Bool *result = va_arg(*list, Eina_Bool *);
1572 if (result) *result = 0; 1572 if (result) *result = 0;
1573 1573
1574 _evas_object_image_cleanup(eo_obj, o); 1574 _evas_object_image_cleanup(eo_obj, obj, o);
1575 if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return; 1575 if ((pixels->w != o->cur.image.w) || (pixels->h != o->cur.image.h)) return;
1576 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 1576
1577 switch (pixels->format) 1577 switch (pixels->format)
1578 { 1578 {
1579#if 0 1579#if 0
@@ -1959,7 +1959,7 @@ _image_colorspace_set(Eo *eo_obj, void *_pd, va_list *list)
1959 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 1959 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
1960 Evas_Object_Image *o = _pd; 1960 Evas_Object_Image *o = _pd;
1961 1961
1962 _evas_object_image_cleanup(eo_obj, o); 1962 _evas_object_image_cleanup(eo_obj, obj, o);
1963 1963
1964 o->cur.cspace = cspace; 1964 o->cur.cspace = cspace;
1965 if (o->engine_data) 1965 if (o->engine_data)
@@ -2001,7 +2001,7 @@ _image_video_surface_set(Eo *eo_obj, void *_pd, va_list *list)
2001 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 2001 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
2002 Evas_Object_Image *o = _pd; 2002 Evas_Object_Image *o = _pd;
2003 2003
2004 _evas_object_image_cleanup(eo_obj, o); 2004 _evas_object_image_cleanup(eo_obj, obj, o);
2005 if (o->video_surface) 2005 if (o->video_surface)
2006 { 2006 {
2007 o->video_surface = EINA_FALSE; 2007 o->video_surface = EINA_FALSE;
@@ -2074,7 +2074,7 @@ _image_native_surface_set(Eo *eo_obj, void *_pd, va_list *list)
2074 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 2074 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
2075 Evas_Object_Image *o = _pd; 2075 Evas_Object_Image *o = _pd;
2076 2076
2077 _evas_object_image_cleanup(eo_obj, o); 2077 _evas_object_image_cleanup(eo_obj, obj, o);
2078 if (!obj->layer->evas->engine.func->image_native_set) return; 2078 if (!obj->layer->evas->engine.func->image_native_set) return;
2079 if ((surf) && 2079 if ((surf) &&
2080 ((surf->version < 2) || 2080 ((surf->version < 2) ||
@@ -3063,6 +3063,7 @@ evas_object_image_init(Evas_Object *eo_obj)
3063 /* set up methods (compulsory) */ 3063 /* set up methods (compulsory) */
3064 obj->func = &object_func; 3064 obj->func = &object_func;
3065 obj->type = o_type; 3065 obj->type = o_type;
3066 obj->cur.opaque_valid = 0;
3066} 3067}
3067 3068
3068static void 3069static void
@@ -3076,7 +3077,6 @@ evas_object_image_new(Evas_Object *eo_obj)
3076 o->cur.border.scale = 1.0; 3077 o->cur.border.scale = 1.0;
3077 o->cur.cspace = EVAS_COLORSPACE_ARGB8888; 3078 o->cur.cspace = EVAS_COLORSPACE_ARGB8888;
3078 o->cur.spread = EVAS_TEXTURE_REPEAT; 3079 o->cur.spread = EVAS_TEXTURE_REPEAT;
3079 o->cur.opaque_valid = 0;
3080 o->cur.source = NULL; 3080 o->cur.source = NULL;
3081 o->prev = o->cur; 3081 o->prev = o->cur;
3082 o->tmpf_fd = -1; 3082 o->tmpf_fd = -1;
@@ -3855,44 +3855,44 @@ static void *evas_object_image_engine_data_get(Evas_Object *eo_obj)
3855static int 3855static int
3856evas_object_image_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 3856evas_object_image_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
3857{ 3857{
3858 Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
3859
3860 /* this returns 1 if the internal object data implies that the object is */ 3858 /* this returns 1 if the internal object data implies that the object is */
3861 /* currently fully opaque over the entire rectangle it occupies */ 3859 /* currently fully opaque over the entire rectangle it occupies */
3862/* disable caching due tyo maps screwing with this 3860/* disable caching due tyo maps screwing with this
3863 o->cur.opaque_valid = 0; 3861 o->cur.opaque_valid = 0;*/
3864 if (o->cur.opaque_valid) 3862 if (obj->cur.opaque_valid)
3865 { 3863 {
3866 if (!o->cur.opaque) return 0; 3864 if (!obj->cur.opaque) return 0;
3867 } 3865 }
3868 else 3866 else
3869*/
3870 { 3867 {
3871 o->cur.opaque = 0; 3868 Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
3872/* disable caching */ 3869
3873/* o->cur.opaque_valid = 1; */ 3870 obj->cur.opaque = 0;
3871 obj->cur.opaque_valid = 1;
3874 if ((o->cur.fill.w < 1) || (o->cur.fill.h < 1)) 3872 if ((o->cur.fill.w < 1) || (o->cur.fill.h < 1))
3875 return o->cur.opaque; 3873 return obj->cur.opaque;
3876 if (((o->cur.border.l != 0) || 3874 if (((o->cur.border.l != 0) ||
3877 (o->cur.border.r != 0) || 3875 (o->cur.border.r != 0) ||
3878 (o->cur.border.t != 0) || 3876 (o->cur.border.t != 0) ||
3879 (o->cur.border.b != 0)) && 3877 (o->cur.border.b != 0)) &&
3880 (!o->cur.border.fill)) return o->cur.opaque; 3878 (!o->cur.border.fill))
3881 if (!o->engine_data) return o->cur.opaque; 3879 return obj->cur.opaque;
3882 o->cur.opaque = 1; 3880 if (!o->engine_data)
3883 } 3881 return obj->cur.opaque;
3884 // FIXME: use proxy 3882
3885 if (o->cur.source) 3883 // FIXME: use proxy
3886 { 3884 if (o->cur.source)
3887 Evas_Object_Protected_Data *cur_source = eo_data_get(o->cur.source, EVAS_OBJ_CLASS); 3885 {
3888 o->cur.opaque = evas_object_is_opaque(o->cur.source, cur_source); 3886 Evas_Object_Protected_Data *cur_source = eo_data_get(o->cur.source, EVAS_OBJ_CLASS);
3889 return o->cur.opaque; /* FIXME: Should go poke at the object */ 3887 obj->cur.opaque = evas_object_is_opaque(o->cur.source, cur_source);
3890 } 3888 return obj->cur.opaque; /* FIXME: Should go poke at the object */
3891 if (o->cur.has_alpha) 3889 }
3892 { 3890 if (o->cur.has_alpha)
3893 o->cur.opaque = 0; 3891 return obj->cur.opaque;
3894 return o->cur.opaque; 3892
3893 obj->cur.opaque = 1;
3895 } 3894 }
3895
3896 if ((obj->cur.map) && (obj->cur.usemap)) 3896 if ((obj->cur.map) && (obj->cur.usemap))
3897 { 3897 {
3898 Evas_Map *m = obj->cur.map; 3898 Evas_Map *m = obj->cur.map;
@@ -3918,48 +3918,97 @@ evas_object_image_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj
3918 (m->points[0].y == obj->cur.geometry.y) && 3918 (m->points[0].y == obj->cur.geometry.y) &&
3919 (m->points[2].x == (obj->cur.geometry.x + obj->cur.geometry.w)) && 3919 (m->points[2].x == (obj->cur.geometry.x + obj->cur.geometry.w)) &&
3920 (m->points[2].y == (obj->cur.geometry.y + obj->cur.geometry.h))) 3920 (m->points[2].y == (obj->cur.geometry.y + obj->cur.geometry.h)))
3921 return o->cur.opaque; 3921 return obj->cur.opaque;
3922 } 3922 }
3923 } 3923 }
3924 o->cur.opaque = 0; 3924 obj->cur.opaque = 0;
3925 return o->cur.opaque; 3925 return obj->cur.opaque;
3926 }
3927 if (obj->cur.render_op == EVAS_RENDER_COPY)
3928 {
3929 obj->cur.opaque = 1;
3930 return obj->cur.opaque;
3926 } 3931 }
3927 if (obj->cur.render_op == EVAS_RENDER_COPY) return o->cur.opaque; 3932 return obj->cur.opaque;
3928 return o->cur.opaque;
3929} 3933}
3930 3934
3931static int 3935static int
3932evas_object_image_was_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 3936evas_object_image_was_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
3933{ 3937{
3934 Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
3935
3936 /* this returns 1 if the internal object data implies that the object was */ 3938 /* this returns 1 if the internal object data implies that the object was */
3937 /* previously fully opaque over the entire rectangle it occupies */ 3939 /* previously fully opaque over the entire rectangle it occupies */
3938 if (o->prev.opaque_valid) 3940 if (obj->prev.opaque_valid)
3939 { 3941 {
3940 if (!o->prev.opaque) return 0; 3942 if (!obj->prev.opaque) return 0;
3941 } 3943 }
3942 else 3944 else
3943 { 3945 {
3944 o->prev.opaque = 0; 3946 Evas_Object_Image *o = eo_data_get(eo_obj, MY_CLASS);
3945 o->prev.opaque_valid = 1; 3947
3948 obj->prev.opaque = 0;
3949 obj->prev.opaque_valid = 1;
3946 if ((o->prev.fill.w < 1) || (o->prev.fill.h < 1)) 3950 if ((o->prev.fill.w < 1) || (o->prev.fill.h < 1))
3947 return 0; 3951 return obj->prev.opaque;
3948 if (((o->prev.border.l != 0) || 3952 if (((o->prev.border.l != 0) ||
3949 (o->prev.border.r != 0) || 3953 (o->prev.border.r != 0) ||
3950 (o->prev.border.t != 0) || 3954 (o->prev.border.t != 0) ||
3951 (o->prev.border.b != 0)) && 3955 (o->prev.border.b != 0)) &&
3952 (!o->prev.border.fill)) return 0; 3956 (!o->prev.border.fill))
3953 if (!o->engine_data) return 0; 3957 return obj->prev.opaque;
3954 o->prev.opaque = 1; 3958 if (!o->engine_data)
3959 return obj->prev.opaque;
3960
3961 // FIXME: use proxy
3962 if (o->prev.source)
3963 return obj->prev.opaque; /* FIXME: Should go poke at the object */
3964 if (o->prev.has_alpha)
3965 return obj->prev.opaque;
3966
3967 obj->prev.opaque = 1;
3955 } 3968 }
3956 // FIXME: use proxy 3969 if (obj->prev.usemap)
3957 if (o->prev.source) return 0; /* FIXME: Should go poke at the object */ 3970 {
3958 if (obj->prev.usemap) return 0; 3971 Evas_Map *m = obj->prev.map;
3959 if (obj->prev.render_op == EVAS_RENDER_COPY) return 1; 3972
3960 if (o->prev.has_alpha) return 0; 3973 if ((m->points[0].a == 255) &&
3961 if (obj->prev.render_op != EVAS_RENDER_BLEND) return 0; 3974 (m->points[1].a == 255) &&
3962 return 1; 3975 (m->points[2].a == 255) &&
3976 (m->points[3].a == 255))
3977 {
3978 if (
3979 ((m->points[0].x == m->points[3].x) &&
3980 (m->points[1].x == m->points[2].x) &&
3981 (m->points[0].y == m->points[1].y) &&
3982 (m->points[2].y == m->points[3].y))
3983 ||
3984 ((m->points[0].x == m->points[1].x) &&
3985 (m->points[2].x == m->points[3].x) &&
3986 (m->points[0].y == m->points[3].y) &&
3987 (m->points[1].y == m->points[2].y))
3988 )
3989 {
3990 if ((m->points[0].x == obj->prev.geometry.x) &&
3991 (m->points[0].y == obj->prev.geometry.y) &&
3992 (m->points[2].x == (obj->prev.geometry.x + obj->prev.geometry.w)) &&
3993 (m->points[2].y == (obj->prev.geometry.y + obj->prev.geometry.h)))
3994 return obj->prev.opaque;
3995 }
3996 }
3997
3998 obj->prev.opaque = 0;
3999 return obj->prev.opaque;
4000 }
4001 if (obj->prev.render_op == EVAS_RENDER_COPY)
4002 {
4003 obj->prev.opaque = 1;
4004 return obj->prev.opaque;
4005 }
4006 if (obj->prev.render_op != EVAS_RENDER_BLEND)
4007 {
4008 obj->prev.opaque = 0;
4009 return obj->prev.opaque;
4010 }
4011 return obj->prev.opaque;
3963} 4012}
3964 4013
3965static int 4014static int
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h
index 283d376a17..6f27fe3f97 100644
--- a/legacy/evas/src/lib/include/evas_private.h
+++ b/legacy/evas/src/lib/include/evas_private.h
@@ -556,6 +556,8 @@ struct _Evas_Object_Protected_Data
556 Eina_Bool valid_bounding_box : 1; 556 Eina_Bool valid_bounding_box : 1;
557 Eina_Bool cached_surface : 1; 557 Eina_Bool cached_surface : 1;
558 Eina_Bool parent_cached_surface : 1; 558 Eina_Bool parent_cached_surface : 1;
559 Eina_Bool opaque_valid : 1;
560 Eina_Bool opaque : 1;
559 } cur, prev; 561 } cur, prev;
560 562
561 struct { 563 struct {