diff --git a/desmume/src/GPU.c b/desmume/src/GPU.c index 785a9306a..eafd208ee 100644 --- a/desmume/src/GPU.c +++ b/desmume/src/GPU.c @@ -504,6 +504,10 @@ INLINE BOOL withinRect (u8 x,u8 y, u16 startX, u16 startY, u16 endX, u16 endY) BOOL wrapx, wrapy, goodx, goody; wrapx = startX > endX; wrapy = startY > endY; + // when the start > end, + // all points between start & end are outside the window, + // otherwise + // they are inside goodx = (wrapx)? ((startX <= x)||(x <= endX)):((startX <= x)&&(x <= endX)); goody = (wrapy)? ((startY <= y)||(y <= endY)):((startY <= y)&&(y <= endY)); return (goodx && goody);