rem: printf ("start_time = %d, end_time = %d\n", time_y_0, time_y_1);
add: fprintf (stderr, "start_time = %d, end_time = %d\n", time_y_0, time_y_1);
context: DrawablesIntersect (PINTERSECT_CONTROL pControl0,		PINTERSECT_CONTROL pControl1, TIME_VALUE		max_time_val){	register SIZE dy;	register SIZE time_y_0, time_y_1;	RECT r0, r1;	FRAMEPTR FramePtr0, FramePtr1;	if (!ContextActive () || max_time_val == 0)		return ((TIME_VALUE)0);	else if (max_time_val > MAX_TIME_VALUE)		max_time_val = MAX_TIME_VALUE;	pControl0->last_time_val = pControl1->last_time_val = 0;	r0.corner = pControl0->IntersectStamp.origin;	r1.corner = pControl1->IntersectStamp.origin;	r0.extent.width = pControl0->EndPoint.x - r0.corner.x;	r0.extent.height = pControl0->EndPoint.y - r0.corner.y;	r1.extent.width = pControl1->EndPoint.x - r1.corner.x;	r1.extent.height = pControl1->EndPoint.y - r1.corner.y;			FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame;	if (FramePtr0 == 0)		return(0);	r0.corner.x -= GetFrameHotX (FramePtr0);	r0.corner.y -= GetFrameHotY (FramePtr0);	FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame;	if (FramePtr1 == 0)		return(0);	r1.corner.x -= GetFrameHotX (FramePtr1);	r1.corner.y -= GetFrameHotY (FramePtr1);	dy = r1.corner.y - r0.corner.y;	time_y_0 = dy - GetFrameHeight (FramePtr0) + 1;	time_y_1 = dy + GetFrameHeight (FramePtr1) - 1;	dy = r0.extent.height - r1.extent.height;	if ((time_y_0 <= 0 && time_y_1 >= 0)			|| (time_y_0 > 0 && dy >= time_y_0)			|| (time_y_1 < 0 && dy <= time_y_1))	{		register SIZE dx;		register SIZE time_x_0, time_x_1;		dx = r1.corner.x - r0.corner.x;		time_x_0 = dx - GetFrameWidth (FramePtr0) + 1;		time_x_1 = dx + GetFrameWidth (FramePtr1) - 1;		dx = r0.extent.width - r1.extent.width;		if ((time_x_0 <= 0 && time_x_1 >= 0)				|| (time_x_0 > 0 && dx >= time_x_0)				|| (time_x_1 < 0 && dx <= time_x_1))		{			TIME_VALUE intersect_time;			if (dx == 0 && dy == 0)				time_y_0 = time_y_1 = 0;			else			{				SIZE t;				long time_beg, time_end, fract;				if (time_y_1 < 0)				{					t = time_y_0;					time_y_0 = -time_y_1;					time_y_1 = -t;				}				else if (time_y_0 <= 0)				{					if (dy < 0)						time_y_1 = -time_y_0;					time_y_0 = 0;				}				if (dy < 0)					dy = -dy;				if (dy < time_y_1)					time_y_1 = dy;					/* just to be safe, widen search area */				--time_y_0;				++time_y_1;				if (time_x_1 < 0)				{					t = time_x_0;					time_x_0 = -time_x_1;					time_x_1 = -t;				}				else if (time_x_0 <= 0)				{					if (dx < 0)						time_x_1 = -time_x_0;					time_x_0 = 0;				}				if (dx < 0)					dx = -dx;				if (dx < time_x_1)					time_x_1 = dx;					/* just to be safe, widen search area */				--time_x_0;				++time_x_1;#ifdef DEBUGprintf ("FramePtr0<%d, %d> --> <%d, %d>\nFramePtr1<%d, %d> --> <%d, %d>\n",GetFrameWidth (FramePtr0), GetFrameHeight (FramePtr0),r0.corner.x, r0.corner.y,GetFrameWidth (FramePtr1), GetFrameHeight (FramePtr1),r1.corner.x, r1.corner.y);printf ("time_x(%d, %d)-%d, time_y(%d, %d)-%d\n", time_x_0, time_x_1, dx, time_y_0, time_y_1, dy);#endif /* DEBUG */				if (dx == 0)				{					time_beg = time_y_0;					time_end = time_y_1;					fract = dy;				}				else if (dy == 0)				{					time_beg = time_x_0;					time_end = time_x_1;					fract = dx;				}				else				{					long time_x, time_y;					time_x = (long)time_x_0 * (long)dy;					time_y = (long)time_y_0 * (long)dx;					time_beg = time_x < time_y ? time_y : time_x;					time_x = (long)time_x_1 * (long)dy;					time_y = (long)time_y_1 * (long)dx;					time_end = time_x > time_y ? time_y : time_x;					fract = (long)dx * (long)dy;				}				if ((time_beg <<= TIME_SHIFT) < fract)					time_y_0 = 0;				else					time_y_0 = (SIZE)(time_beg / fract);				if (time_end >= fract /* just in case of overflow */						|| (time_end <<= TIME_SHIFT) >=						fract * (long)max_time_val)					time_y_1 = max_time_val - 1;				else					time_y_1 = (SIZE)((time_end + fract - 1) / fract) - 1;			}#ifdef DEBUGprintf ("start_time = %d, end_time = %d\n", time_y_0, time_y_1);#endif /* DEBUG */			if (time_y_0 <= time_y_1					&& (intersect_time = frame_intersect (					pControl0, &r0, pControl1, &r1,					(TIME_VALUE)time_y_0, (TIME_VALUE)time_y_1)))			{				FramePtr0 = (FRAMEPTR)pControl0->IntersectStamp.frame;				pControl0->EndPoint.x = r0.corner.x + GetFrameHotX (FramePtr0);				pControl0->EndPoint.y = r0.corner.y + GetFrameHotY (FramePtr0);				FramePtr1 = (FRAMEPTR)pControl1->IntersectStamp.frame;				pControl1->EndPoint.x = r1.corner.x + GetFrameHotX (FramePtr1);				pControl1->EndPoint.y = r1.corner.y + GetFrameHotY (FramePtr1);				return (intersect_time);			}		}	}	return ((TIME_VALUE)0);}