Enlightenment CVS committal
Author : barbieri
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas
Modified Files:
evas_object_main.c
Log Message:
Save memory related to size hints.
Size hints are useful, but wasting 36 bytes for it on every object is a bit
too much: clippers and lots of other objects will have no need for it.
Now it's a pointer to a struct that will be allocated just when some value
is set, wasting 4/8 bytes more for the pointer when it is used, but saving
32/28 bytes when it is not.
This will also help to have alignment properties in future, that can come
as hints, without too much impact on memory consumption.
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_object_main.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- evas_object_main.c 11 Apr 2008 23:12:19 -0000 1.64
+++ evas_object_main.c 30 Apr 2008 22:51:08 -0000 1.65
@@ -67,6 +67,7 @@
free(node);
}
obj->magic = 0;
+ if (obj->size_hints) free(obj->size_hints);
free(obj);
}
@@ -697,13 +698,13 @@
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
- if (obj->delete_me)
+ if ((!obj->size_hints) || obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
- if (w) *w = obj->size_hints.min.w;
- if (h) *h = obj->size_hints.min.h;
+ if (w) *w = obj->size_hints->min.w;
+ if (h) *h = obj->size_hints->min.h;
}
/**
@@ -725,9 +726,11 @@
MAGIC_CHECK_END();
if (obj->delete_me)
return;
+ if (obj->size_hints)
+ obj->size_hints = calloc(1, sizeof(*obj->size_hints));
- obj->size_hints.min.w = w;
- obj->size_hints.min.h = h;
+ obj->size_hints->min.w = w;
+ obj->size_hints->min.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
@@ -753,13 +756,13 @@
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
- if (obj->delete_me)
+ if ((!obj->size_hints) || obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
- if (w) *w = obj->size_hints.max.w;
- if (h) *h = obj->size_hints.max.h;
+ if (w) *w = obj->size_hints->max.w;
+ if (h) *h = obj->size_hints->max.h;
}
/**
@@ -781,9 +784,11 @@
MAGIC_CHECK_END();
if (obj->delete_me)
return;
+ if (obj->size_hints)
+ obj->size_hints = calloc(1, sizeof(*obj->size_hints));
- obj->size_hints.max.w = w;
- obj->size_hints.max.h = h;
+ obj->size_hints->max.w = w;
+ obj->size_hints->max.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
@@ -809,13 +814,13 @@
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
- if (obj->delete_me)
+ if ((!obj->size_hints) || obj->delete_me)
{
if (w) *w = 0; if (h) *h = 0;
return;
}
- if (w) *w = obj->size_hints.request.w;
- if (h) *h = obj->size_hints.request.h;
+ if (w) *w = obj->size_hints->request.w;
+ if (h) *h = obj->size_hints->request.h;
}
/**
@@ -837,9 +842,10 @@
MAGIC_CHECK_END();
if (obj->delete_me)
return;
+ if (obj->size_hints) obj->size_hints = calloc(1, sizeof(*obj->size_hints));
- obj->size_hints.request.w = w;
- obj->size_hints.request.h = h;
+ obj->size_hints->request.w = w;
+ obj->size_hints->request.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
@@ -867,15 +873,15 @@
if (w) *w = 0; if (h) *h = 0;
return;
MAGIC_CHECK_END();
- if (obj->delete_me)
+ if ((!obj->size_hints) || obj->delete_me)
{
if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
if (w) *w = 0; if (h) *h = 0;
return;
}
- if (aspect) *aspect = obj->size_hints.aspect.mode;
- if (w) *w = obj->size_hints.aspect.size.w;
- if (h) *h = obj->size_hints.aspect.size.h;
+ if (aspect) *aspect = obj->size_hints->aspect.mode;
+ if (w) *w = obj->size_hints->aspect.size.w;
+ if (h) *h = obj->size_hints->aspect.size.h;
}
/**
@@ -898,10 +904,12 @@
MAGIC_CHECK_END();
if (obj->delete_me)
return;
+ if (obj->size_hints)
+ obj->size_hints = calloc(1, sizeof(*obj->size_hints));
- obj->size_hints.aspect.mode = aspect;
- obj->size_hints.aspect.size.w = w;
- obj->size_hints.aspect.size.h = h;
+ obj->size_hints->aspect.mode = aspect;
+ obj->size_hints->aspect.size.w = w;
+ obj->size_hints->aspect.size.h = h;
evas_object_inform_call_changed_size_hints(obj);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs