rem: PRINT(("%s\n", __PRETTY_FUNCTION__));
context: r_sub(long top, long bottom, BRegion *first, BRegion *second, BRegion *dest, long *indexA, long *indexB){	PRINT(("%s\n", __PRETTY_FUNCTION__));		int32 leftsA[kMaxPoints / 2];	int32 rightsA[kMaxPoints / 2];	int32 leftsB[kMaxPoints / 2];	int32 rightsB[kMaxPoints / 2];		long i1 = *indexA;	long i2 = *indexB;		*indexA = -1;	*indexB = -1;		long foundA = 0;	long foundB = 0;	long x = 0;		// Store left and right points to the appropriate array	for (x = i1; x < first->count; x++) {				// Look if this rect can be used next time we are called, 		// thus correctly maintaining the "index" parameters.		if (first->data[x].bottom >= top && *indexA == -1)			*indexA = x;					if (first->data[x].top <= top && first->data[x].bottom >= bottom) {			leftsA[foundA] = first->data[x].left;			rightsA[foundA] = first->data[x].right;			foundA++;			} else if (first->data[x].top > bottom)			break;		}		if (*indexA == -1)		*indexA = i1;		if (foundA > 1)		sort_trans(leftsA, rightsA, foundA);						for (x = i2; x < second->count; x++) {		if (second->data[x].bottom >= top && *indexB == -1)			*indexB = x;				if (second->data[x].top <= top && second->data[x].bottom >= bottom) {			leftsB[foundB] = second->data[x].left;			rightsB[foundB] = second->data[x].right;			foundB++;		} else if (second->data[x].top > bottom)			break;	}		if (*indexB == -1)		*indexB = i2;			if (foundB > 1)		sort_trans(leftsB, rightsB, foundB);	// No minuend's rect, just add all the subtraend's rects.	if (foundA == 0)		for (x = 0; x < foundB; x++) {			clipping_rect rect = { leftsB[x], top, rightsB[x], bottom };			dest->_AddRect(rect);		}	else if (foundB > 0) {		long f = 0, s = 0;				clipping_rect minuendRect;		minuendRect.top = top;		minuendRect.bottom = bottom;		minuendRect.left = 0x80000003;				clipping_rect subRect;		subRect.top = top;		subRect.bottom = bottom;					// We take the empty spaces between the minuend rects, and intersect		// these with the subtraend rects. We then add their intersection		// to the destination region.		do {						subRect.left = leftsB[s];			subRect.right = rightsB[s];							if (f != 0)				minuendRect.left = rightsA[f - 1] + 1;						minuendRect.right = leftsA[f] - 1;							if (leftsB[s] > minuendRect.right) {				if (++f > foundA)					break;				else					continue;						}						clipping_rect intersection = sect_rect(minuendRect, subRect);						if (valid_rect(intersection))				dest->_AddRect(intersection);					if (rightsB[s] < minuendRect.left)				s++;								if (s >= foundB)				break;						f++;									} while (f < foundA);				//Last rect: we take the right coordinate of the last minuend rect		//as left coordinate of the rect to intersect, and the maximum possible		//value as the right coordinate.  		minuendRect.left = rightsA[foundA - 1] + 1;		minuendRect.right = 0x7ffffffd;				// Skip the subtraend rects that could never intersect.		while (s < foundB && rightsB[s] < minuendRect.left)			s++;				for (long c = s; c < foundB; c++) {			subRect.left = leftsB[c];			subRect.right = rightsB[c];						clipping_rect intersection = sect_rect(minuendRect, subRect);						if (valid_rect(intersection))				dest->_AddRect(intersection);		}		}}