summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-02-04 12:08:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-02-04 15:03:37 +0900
commita688ba45c88b74ea6c4543a24a060d41ef2a33d5 (patch)
treed83056f40e311227c08954d19b2ce9502c3762c2
parentfbacbf7350d0ad65b5a7f684ae6c82aa801e37f2 (diff)
Evas masking: Fix some remaining issues with animations
Yeah, mixing maps and masks of masks in a genlist leads to tons of amazing bugs :) This commit removes x,y from the "mask" field in an object, as they are duplicates of cur->geometry.{x,y} but were not properly kept in sync. This patch fixes a situation of: - A genlist in a map - Each item has an icon masked - Scrolling the genlist --> The masked items would not render properly before this patch. Remaining known problem: - Mask a genlist (big mask) - Each item has an icon masked (small mask) - Apply a map to the genlist - Scrolling the genlist --> The big mask still works but totally screws up the small icons with masks. Note: These changes look scary just before the release but I would have to backport them to 1.13.x as they definitely are bug fixes. Also, they only concern code paths used exclusively by masking.
-rw-r--r--src/lib/evas/canvas/evas_clip.c2
-rw-r--r--src/lib/evas/canvas/evas_object_main.c6
-rw-r--r--src/lib/evas/canvas/evas_render.c35
-rw-r--r--src/lib/evas/include/evas_private.h2
4 files changed, 25 insertions, 20 deletions
diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c
index 08166644aa..0e1d43a0bd 100644
--- a/src/lib/evas/canvas/evas_clip.c
+++ b/src/lib/evas/canvas/evas_clip.c
@@ -205,8 +205,6 @@ _evas_object_clip_mask_unset(Evas_Object_Protected_Data *obj)
205 (obj->layer->evas->engine.data.output, mask->surface); 205 (obj->layer->evas->engine.data.output, mask->surface);
206 mask->surface = NULL; 206 mask->surface = NULL;
207 } 207 }
208 mask->x = 0;
209 mask->y = 0;
210 mask->w = 0; 208 mask->w = 0;
211 mask->h = 0; 209 mask->h = 0;
212 EINA_COW_WRITE_END(evas_object_mask_cow, obj->mask, mask); 210 EINA_COW_WRITE_END(evas_object_mask_cow, obj->mask, mask);
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 4e1237f921..da97914345 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -185,7 +185,7 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer)
185 mask->is_mask = EINA_FALSE; 185 mask->is_mask = EINA_FALSE;
186 mask->redraw = EINA_FALSE; 186 mask->redraw = EINA_FALSE;
187 mask->is_alpha = EINA_FALSE; 187 mask->is_alpha = EINA_FALSE;
188 mask->x = mask->y = mask->w = mask->h = 0; 188 mask->w = mask->h = 0;
189 if (mask->surface) 189 if (mask->surface)
190 { 190 {
191 obj->layer->evas->engine.func->image_map_surface_free 191 obj->layer->evas->engine.func->image_map_surface_free
@@ -1264,14 +1264,14 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1264 if (obj->mask->is_mask) 1264 if (obj->mask->is_mask)
1265 { 1265 {
1266 if (obj->mask->surface || 1266 if (obj->mask->surface ||
1267 obj->mask->x || obj->mask->y || obj->mask->w || obj->mask->h || 1267 obj->mask->w || obj->mask->h ||
1268 obj->mask->is_alpha || obj->mask->redraw) 1268 obj->mask->is_alpha || obj->mask->redraw)
1269 { 1269 {
1270 EINA_COW_WRITE_BEGIN(evas_object_mask_cow, obj->mask, 1270 EINA_COW_WRITE_BEGIN(evas_object_mask_cow, obj->mask,
1271 Evas_Object_Mask_Data, mask) 1271 Evas_Object_Mask_Data, mask)
1272 mask->redraw = EINA_FALSE; 1272 mask->redraw = EINA_FALSE;
1273 mask->is_alpha = EINA_FALSE; 1273 mask->is_alpha = EINA_FALSE;
1274 mask->x = mask->y = mask->w = mask->h = 0; 1274 mask->w = mask->h = 0;
1275 if (mask->surface) 1275 if (mask->surface)
1276 { 1276 {
1277 obj->layer->evas->engine.func->image_map_surface_free 1277 obj->layer->evas->engine.func->image_map_surface_free
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 9f78e55b38..b0fc2d1ac3 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -1494,9 +1494,9 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1494 1494
1495 if (mapped) 1495 if (mapped)
1496 { 1496 {
1497 Eina_Bool restore_image_clip = EINA_FALSE; 1497 Eina_Bool restore_image_clip = EINA_FALSE, old_use_clip = EINA_FALSE;
1498 int oldm_x = 0, oldm_y = 0, ocx = 0, ocy = 0, ocw = 0, och = 0;
1498 void *oldm_sfc = NULL; 1499 void *oldm_sfc = NULL;
1499 int oldm_x = 0, oldm_y = 0;
1500 1500
1501 RDI(level); 1501 RDI(level);
1502 RD(" draw child of mapped obj\n"); 1502 RD(" draw child of mapped obj\n");
@@ -1524,11 +1524,14 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1524 e->engine.func->context_clip_image_get 1524 e->engine.func->context_clip_image_get
1525 (e->engine.data.output, ctx, 1525 (e->engine.data.output, ctx,
1526 &oldm_sfc, &oldm_x, &oldm_y); 1526 &oldm_sfc, &oldm_x, &oldm_y);
1527 old_use_clip = e->engine.func->context_clip_get
1528 (e->engine.data.output, ctx,
1529 &ocx, &ocy, &ocw, &och);
1527 e->engine.func->context_clip_image_set 1530 e->engine.func->context_clip_image_set
1528 (e->engine.data.output, ctx, 1531 (e->engine.data.output, ctx,
1529 mask->mask->surface, 1532 mask->mask->surface,
1530 mask->mask->x + off_x, 1533 mask->cur->geometry.x + off_x,
1531 mask->mask->y + off_y); 1534 mask->cur->geometry.y + off_y);
1532 } 1535 }
1533 } 1536 }
1534 1537
@@ -1579,11 +1582,14 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1579 e->engine.func->context_clip_image_get 1582 e->engine.func->context_clip_image_get
1580 (e->engine.data.output, ctx, 1583 (e->engine.data.output, ctx,
1581 &oldm_sfc, &oldm_x, &oldm_y); 1584 &oldm_sfc, &oldm_x, &oldm_y);
1585 old_use_clip = e->engine.func->context_clip_get
1586 (e->engine.data.output, ctx,
1587 &ocx, &ocy, &ocw, &och);
1582 e->engine.func->context_clip_image_set 1588 e->engine.func->context_clip_image_set
1583 (e->engine.data.output, ctx, 1589 (e->engine.data.output, ctx,
1584 mask->mask->surface, 1590 mask->mask->surface,
1585 mask->mask->x + off_x, 1591 mask->cur->geometry.x + off_x,
1586 mask->mask->y + off_y); 1592 mask->cur->geometry.y + off_y);
1587 } 1593 }
1588 } 1594 }
1589 } 1595 }
@@ -1593,6 +1599,10 @@ evas_render_mapped(Evas_Public_Data *e, Evas_Object *eo_obj,
1593 } 1599 }
1594 if (restore_image_clip) 1600 if (restore_image_clip)
1595 { 1601 {
1602 if (old_use_clip)
1603 e->engine.func->context_clip_set(e->engine.data.output, ctx, ocx, ocy, ocw, och);
1604 else
1605 e->engine.func->context_clip_unset(e->engine.data.output, ctx);
1596 e->engine.func->context_clip_image_set 1606 e->engine.func->context_clip_image_set
1597 (e->engine.data.output, ctx, oldm_sfc, oldm_x, oldm_y); 1607 (e->engine.data.output, ctx, oldm_sfc, oldm_x, oldm_y);
1598 } 1608 }
@@ -1791,14 +1801,11 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
1791 { 1801 {
1792 mdata->surface = ENFN->image_map_surface_new(ENDT, w, h, EINA_TRUE); 1802 mdata->surface = ENFN->image_map_surface_new(ENDT, w, h, EINA_TRUE);
1793 if (!mdata->surface) goto end; 1803 if (!mdata->surface) goto end;
1804 mdata->is_alpha = EINA_FALSE;
1794 mdata->w = w; 1805 mdata->w = w;
1795 mdata->h = h; 1806 mdata->h = h;
1796 } 1807 }
1797 1808
1798 mdata->x = x;
1799 mdata->y = y;
1800 mdata->is_alpha = EINA_FALSE;
1801
1802 /* Clear surface with transparency */ 1809 /* Clear surface with transparency */
1803 ctx = ENFN->context_new(ENDT); 1810 ctx = ENFN->context_new(ENDT);
1804 ENFN->context_color_set(ENDT, ctx, 0, 0, 0, 0); 1811 ENFN->context_color_set(ENDT, ctx, 0, 0, 0, 0);
@@ -1812,8 +1819,8 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
1812 { 1819 {
1813 ENFN->context_clip_image_set(ENDT, ctx, 1820 ENFN->context_clip_image_set(ENDT, ctx,
1814 prev_mask->mask->surface, 1821 prev_mask->mask->surface,
1815 prev_mask->mask->x - x, 1822 prev_mask->cur->geometry.x - x,
1816 prev_mask->mask->y - y); 1823 prev_mask->cur->geometry.y - y);
1817 } 1824 }
1818 evas_render_mapped(evas, mask->object, mask, ctx, mdata->surface, 1825 evas_render_mapped(evas, mask->object, mask, ctx, mdata->surface,
1819 -x, -y, 1, 0, 0, evas->output.w, evas->output.h, 1826 -x, -y, 1, 0, 0, evas->output.w, evas->output.h,
@@ -2348,8 +2355,8 @@ evas_render_updates_internal(Evas *eo_e,
2348 (e->engine.data.output, 2355 (e->engine.data.output,
2349 e->engine.data.context, 2356 e->engine.data.context,
2350 mask->mask->surface, 2357 mask->mask->surface,
2351 mask->mask->x + off_x, 2358 mask->cur->geometry.x + off_x,
2352 mask->mask->y + off_y); 2359 mask->cur->geometry.y + off_y);
2353 } 2360 }
2354 } 2361 }
2355 2362
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 10c918e3c5..673b6aab77 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -895,7 +895,7 @@ struct _Evas_Object_3D_Data
895struct _Evas_Object_Mask_Data 895struct _Evas_Object_Mask_Data
896{ 896{
897 void *surface; 897 void *surface;
898 int x, y, w, h; 898 int w, h;
899 Eina_Bool is_mask : 1; 899 Eina_Bool is_mask : 1;
900 Eina_Bool redraw : 1; 900 Eina_Bool redraw : 1;
901 Eina_Bool is_alpha : 1; 901 Eina_Bool is_alpha : 1;