Enlightenment CVS committal
Author : tsauerbeck
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/lib
Modified Files:
edje_calc.c edje_private.h
Log Message:
trying to make the code more readable
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- edje_calc.c 29 Oct 2004 22:32:35 -0000 1.48
+++ edje_calc.c 30 Oct 2004 12:19:33 -0000 1.49
@@ -18,8 +18,8 @@
{
double npos;
- if (pos > 1.0) pos = 1.0;
- else if (pos < 0.0) pos = 0.0;
+ pos = CLAMP(pos, 0.0, 1.0);
+
npos = 0.0;
/* take linear pos along timescale and use interpolation method */
switch (mode)
@@ -193,22 +193,19 @@
if (ep->confine_to)
{
double dx, dy, dw, dh;
- int ret;
+ int ret = 0;
- ret = 0;
if ((ep->part->dragable.x != 0) &&
(ep->part->dragable.y != 0 )) ret = 3;
else if (ep->part->dragable.x != 0) ret = 1;
else if (ep->part->dragable.y != 0) ret = 2;
dx = ep->x - ep->confine_to->x;
- dw = ep->confine_to->w - ep->w;
- if (dw < 1) dw = 1;
+ dw = MAX(ep->confine_to->w - ep->w, 1);
dx /= dw;
dy = ep->y - ep->confine_to->y;
- dh = ep->confine_to->h - ep->h;
- if (dh < 1) dh = 1;
+ dh = MAX(ep->confine_to->h - ep->h, 1);
dy /= dh;
if (x) *x = dx;
@@ -854,26 +851,13 @@
/* visible is special */
if ((p1.visible) && (!p2.visible))
- {
- if (pos == 1.0)
- p3.visible = 0;
- else
- p3.visible = 1;
- }
+ p3.visible = (pos != 1.0);
else if ((!p1.visible) && (p2.visible))
- {
- if (pos == 0.0)
- p3.visible = 0;
- else
- p3.visible = 1;
- }
+ p3.visible = (pos != 0.0);
else
p3.visible = p1.visible;
- if (pos < 0.5)
- p3.smooth = p1.smooth;
- else
- p3.smooth = p2.smooth;
+ p3.smooth = (pos < 0.5) ? p1.smooth : p2.smooth;
/* FIXME: do x and y separately base on flag */
p3.x = (p1.x * (1.0 - pos)) + (p2.x * (pos));
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -3 -r1.76 -r1.77
--- edje_private.h 30 Oct 2004 11:47:23 -0000 1.76
+++ edje_private.h 30 Oct 2004 12:19:33 -0000 1.77
@@ -24,6 +24,10 @@
#define ABS(x) (x < 0 ? -x : x)
#endif
+#ifndef CLAMP
+#define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
+#endif
+
/* increment this when the EET data descriptors have changed and old
* EETs cannot be loaded/used correctly anymore.
*/
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs