raster pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=212fdcacb0a60987c14725388f658840950a8786
commit 212fdcacb0a60987c14725388f658840950a8786 Author: kabeer khan <kabeer.k...@samsung.com> Date: Tue Dec 16 20:01:04 2014 +0900 elm_list : Resolved TODO in elm_list.c and declared corresponding macros in elm_macros.h Summary: As mentioned in TODO replaced expressions in if statement with macros in elm_macros. Signed-off-by: kabeer khan <kabeer.k...@samsung.com> Reviewers: seoz, raster Reviewed By: raster Subscribers: raster Differential Revision: https://phab.enlightenment.org/D1424 --- src/lib/elm_list.c | 6 ++---- src/lib/elm_macros.h | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index 1a94b43..ba907c5 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -3038,16 +3038,14 @@ _elm_list_item_coordinates_adjust(Elm_List_Item_Data *it, *h = ih; if (!sd->h_mode) { - //TODO: Enhance it later. declare a macro in elm_macros.h - if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh)) + if (ELM_RECTS_X_AXIS_OUT(ix, iy, iw, ih, vx, vy, vw, vh)) *y = iy - ih; else if (iy < vy) *y = iy + ih; } else { - //TODO: Enhance it later. declare a macro in elm_macros.h - if ((iy < vy) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh)) + if (ELM_RECTS_Y_AXIS_OUT(ix, iy, iw, ih, vx, vy, vw, vh)) *x = ix - iw; else if (ix < vx) *x = ix + iw; diff --git a/src/lib/elm_macros.h b/src/lib/elm_macros.h index 859be13..2f62003 100644 --- a/src/lib/elm_macros.h +++ b/src/lib/elm_macros.h @@ -8,3 +8,9 @@ // check if the rect (x, y, w, h) includes whole body of rect (xx, yy, ww, hh) #define ELM_RECTS_INCLUDE(x, y, w, h, xx, yy, ww, hh) (((x) <= (xx)) && (((x) + (w)) >= ((xx + (ww))) && ((y) <= (yy)) && (((y) + (h)) >= ((yy) + (hh))))) + +// check if the rect (x,y,w,h) is either left of or stays out of body of rect(xx,yy,ww,hh) +#define ELM_RECTS_X_AXIS_OUT(x, y, w, h, xx, yy, ww, hh) (((x) < (xx)) || (((x) + (w)) > ((xx) + (ww))) || (((y) + (h)) > ((yy) + (hh)))) + +// check if the rect (x,y,w,h) is either top of or stays out of body of rect(xx,yy,ww,hh) +#define ELM_RECTS_Y_AXIS_OUT(x, y, w, h, xx, yy, ww, hh) (((y) < (yy)) || (((x) + (w)) > ((xx) + (ww))) || (((y) + (h)) > ((yy) + (hh)))) --