summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-12-05 18:54:10 -0800
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-11 10:36:11 +0100
commit939b0f1a9cc149e0b5090d3733e473f5edf5214f (patch)
tree511587893341ef094656014c05370989909f7928
parent119cb085fadb55adf71bd20f2ca30056bc99991f (diff)
evas: avoid unecessary Eina_Cow GC during image destruction.
If the stretch zone are NULL to start with, there is no reason to modify them and this should avoid us a trip to the GC. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10816
-rw-r--r--src/lib/evas/canvas/evas_object_image.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 192c428..fa3a4a8 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -753,18 +753,22 @@ _efl_canvas_image_internal_efl_gfx_image_stretch_region_set(Eo *eo_obj, Evas_Ima
753 // we do change it, we have to make sure nobody is accessing them anymore by 753 // we do change it, we have to make sure nobody is accessing them anymore by
754 // blocking rendering. 754 // blocking rendering.
755 evas_object_async_block(obj); 755 evas_object_async_block(obj);
756 EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write) 756 if (pd->cur->stretch.horizontal.region ||
757 { 757 pd->cur->stretch.vertical.region)
758 if (state_write->free_stretch) free(state_write->stretch.horizontal.region); 758 {
759 state_write->stretch.horizontal.region = NULL; 759 EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write)
760 {
761 if (state_write->free_stretch) free(state_write->stretch.horizontal.region);
762 state_write->stretch.horizontal.region = NULL;
760 763
761 if (state_write->free_stretch) free(state_write->stretch.vertical.region); 764 if (state_write->free_stretch) free(state_write->stretch.vertical.region);
762 state_write->stretch.vertical.region = NULL; 765 state_write->stretch.vertical.region = NULL;
763 766
764 state_write->free_stretch = EINA_FALSE; 767 state_write->free_stretch = EINA_FALSE;
765 state_write->stretch_loaded = EINA_FALSE; 768 state_write->stretch_loaded = EINA_FALSE;
766 } 769 }
767 EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write); 770 EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write);
771 }
768 772
769 if (!horizontal && !vertical) return 0; 773 if (!horizontal && !vertical) return 0;
770 if (!horizontal || !vertical) goto on_error; 774 if (!horizontal || !vertical) goto on_error;