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.khan@samsung.com>

Reviewers: seoz, raster

Reviewed By: raster

Subscribers: raster

Differential Revision: https://phab.enlightenment.org/D1424
This commit is contained in:
kabeer khan 2014-12-16 20:01:04 +09:00 committed by Carsten Haitzler (Rasterman)
parent f2cf41dc1c
commit 8d4437b1f9
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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))))