⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reg09.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
📖 第 1 页 / 共 3 页
字号:
				numRects1--;
				if(numRects1 > 0)
					continue;
			}
			else 
			{
				numRects2--;
				if(numRects2 > 0)
					continue;
			}
		}/* end at AddRectDone  */
		if(rlistID != RECT_LST1)
		{
			rectList2 = temRect;
			break;
		}

		rectList1 = temRect;
DoRectList2:
		if(numRects2 == 0) break;

		rlistID = RECT_LST2;
		temRect = rectList2;
		curtLeftEdge = &aetHead;
	}/* end while  */


/* ----------------------------------------------------- */
/* ***************************************************** */
/* Scan out the AET by widing rule. If this scan-out proves
   to be different from the last one, add a new YX band  */
/* ----------------------------------------------------- */
	
	destPtr = destSave;
	snPtr = aetHead.NextBlock;
	bePtr = &aetHead;
	switch (rgnOP & 3)
	{
	case 0:
/* ----------------------------------------------------- */
/*					      UNION                          */
/* ----------------------------------------------------- */
		while(snPtr != bePtr)
		{
		/* Point to next edge  */			
			alTest = LEFT_EDGE;
			temNUM = (short) snPtr->rX; /* Save the current X coordinate of edge  */
			do{
				snPtr = snPtr->NextBlock;
				alTest += snPtr->rDir;
			}while(alTest != 0);
			

		/* Check at the end of the previous YX band?  */		
			if( (destScanMax == destPtr) ||
				(destPtr->Xmin != temNUM)	   ||
				(destPtr->Xmax != snPtr->rX )     )
					goto Haschanged;
				destPtr++;
				snPtr = snPtr->NextBlock;
		}
		break;

	case 1:
/* -----------INTERSECTION---------------------------------- */	
		/* Find the matching Left Edge  */
		alTest = ahTest = 0;
		while(snPtr != bePtr)
		{

	/* Check for the edge of List1 or List2  */
			if(snPtr->rList == RECT_LST1)
			{
				alTest += snPtr->rDir;
				if((alTest == 0) || (ahTest == 0))
				{
					snPtr = snPtr->NextBlock;
					continue;
				}
			}
			else 
			{
				ahTest += snPtr->rDir;				
				if((ahTest == 0) || (alTest == 0))
				{
					snPtr = snPtr->NextBlock;
					continue;
				}
			}

		/* Find the matching Right Edge  */
	/* Check for the edge of List1 or List2  */
			temNUM = (short) snPtr->rX; /* Save the current X coordinate of edge  */
			snPtr = snPtr->NextBlock; /* Point to the next edge  */
			if(snPtr == bePtr) break; /* End of AET  */

			if(snPtr->rList == RECT_LST1)
			{
				alTest += (short) snPtr->rDir;
			}
			else
			{
				ahTest += (short) snPtr->rDir;
			}

		/* Found the matching pair of edges  */
			edgeState = (ahTest << 8) + alTest;

			if( (destScanMax == destPtr) ||		
				(destPtr->Xmin != temNUM) ||
				(destPtr->Xmax != snPtr->rX) )
					goto Haschanged;
		
			destPtr++;
			snPtr = snPtr->NextBlock;
		}
		break;

	case 2:
/* --------------SUBTRACTION---------------------------- */	
		/* Find the matching Left Edge  */
		alTest = ahTest = 0;
		while(snPtr != bePtr)
		{

	/* Check for the edge of List1 or List2  */
			if(snPtr->rList == RECT_LST1)
			{
				alTest += snPtr->rDir;
				if((alTest == 0) || (ahTest != 0))
				{
					snPtr = snPtr->NextBlock;
					continue;
				}
			}
			else 
			{
				ahTest += snPtr->rDir;				
				if((ahTest != 0) || (alTest == 0))
				{
					snPtr = snPtr->NextBlock;
					continue;
				}
			}

		/* Find the matching Right Edge  */
	/* Check for the edge of List1 or List2  */
			temNUM = (short) snPtr->rX; /* Save the current X coordinate of edge  */
			snPtr = snPtr->NextBlock; /* Point to the next edge  */
			if(snPtr == bePtr) break; /* End of AET  */

			if(snPtr->rList == RECT_LST1)
			{
				alTest += (short) snPtr->rDir;
			}
			else
			{
				ahTest += (short) snPtr->rDir;
			}

		/* Found the matching pair of edges  */
			edgeState = (ahTest << 8) + alTest;

			if( (destScanMax == destPtr) ||		
				(destPtr->Xmin != temNUM) ||
				(destPtr->Xmax != snPtr->rX) )
					goto Haschanged;
		
			destPtr++;
			snPtr = snPtr->NextBlock;
		}
		break;

	case 3:
/* -----------------XOR-------------------------------- */	
		/* Find the matching Left Edge  */
		alTest = ahTest = 0;
		while(snPtr != bePtr)
		{

	/* Check for the edge of List1 or List2  */
			if(snPtr->rList == RECT_LST1)
			{
				alTest += snPtr->rDir;
				if(alTest == 0)
				{
					if (ahTest == 0)
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}
				else
				{
					if (ahTest != 0)
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}
			}
			else 
			{
				ahTest += snPtr->rDir;				
				if(ahTest == 0)
				{
					if (alTest == 0)
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}
				else
				{
					if (alTest != 0)
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}
			}

		/* Find the matching Right Edge  */
	/* Check for the edge of List1 or List2  */
			temNUM = (short) snPtr->rX; /* Save the current X coordinate of edge  */
			snPtr = snPtr->NextBlock; /* Point to the next edge  */
			if(snPtr == bePtr) break; /* End of AET  */

			if(snPtr->rList == RECT_LST1)
			{
				alTest += (short) snPtr->rDir;
			}
			else
			{
				ahTest += (short) snPtr->rDir;
			}

		/* Found the matching pair of edges  */
			edgeState = (ahTest << 8) + alTest;

			if( (destScanMax == destPtr) ||		
				(destPtr->Xmin != temNUM) ||
				(destPtr->Xmax != snPtr->rX) )
					goto Haschanged;
		
			destPtr++;
			snPtr = snPtr->NextBlock;
		}
	}

/* End DO JUMP ONE  */

/* ----------------------------------------------------- */
/* ------------------- CheckForChange ------------------ */
	if(destScanMax != destPtr)
	{
		ret_val = HandleChange(destRGN, &destSizeLeft, destScanMax,
			baseDestSize, curtY, makeRegion);
	
		if(ret_val != 0) 
		{
			nuGrafErr((short) ret_val);
			SetupEmptyRegion(destRGN, makeRegion, sizeRGN);
			return(0);
		}
	

		destScanMax = destPtr;
		regionSize += ((long) destPtr - (long) destSave);
		if(regionSize > 32767)
		{
			grafErrValue = c_RectList + c_RgnOflow;
			nuGrafErr(grafErrValue);
			SetupEmptyRegion(destRGN, makeRegion, sizeRGN);
			return(0);
		}
	}
	goto AETScanDone;

/* ----------------------------------------------------- */
/* ---------------------- HasChanged ------------------- */
Haschanged:	
	ret_val = HandleChange(destRGN, &destSizeLeft, destScanMax,
		baseDestSize, curtY, makeRegion);

	if(ret_val != 0) 
	{
		nuGrafErr((short) ret_val);
		SetupEmptyRegion(destRGN, makeRegion, sizeRGN);
		return(0);
	}

	bePtr = &aetHead;
StoreNewRect:
	if(temNUM < snPtr->rX)
	{
		destSizeLeft -= sizeof(rect);
		if(destSizeLeft < 0)
		{
/*Out of space in dest; return either out of memory error (if just finding
size, because we ran out of single-YX-band buffer space), or region
overflow (if building region, because we ran out of YX band storage).  */

			if(makeRegion == 0)
			{
				grafErrValue = c_RectList + c_OutofMem;
			}
			else
			{
				grafErrValue = c_RectList + c_RgnOflow;
			}
		
			nuGrafErr(grafErrValue);
			SetupEmptyRegion(destRGN, makeRegion, sizeRGN);
			return(0);
		}
		destPtr->Ymin = curtY;
		destPtr->Xmin = temNUM;
		destPtr->Xmax = (short) snPtr->rX;
		destPtr++;
	}

	snPtr = snPtr->NextBlock;
/* This suppose to be equal but not  */	

	if(snPtr != bePtr)
	{
		switch (rgnOP & 3)
		{
		case 0:	/* Do Union 2  */
			temNUM = (short) snPtr->rX;
			alTest = LEFT_EDGE;			
			do{
				snPtr = snPtr->NextBlock;
				alTest +=  (short) snPtr->rDir;			
			}while(alTest != 0);
			goto StoreNewRect;

		case 1:	/* Do Intersection */
			alTest = edgeState & 0xff;
			ahTest = edgeState >> 8;
			while (snPtr != bePtr)
			{
				if(snPtr->rList == RECT_LST1)
				{
					alTest += snPtr->rDir;
					if( (alTest == 0) || (ahTest == 0))
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}
				else
				{
					ahTest += snPtr->rDir;
					if( (ahTest == 0) || (alTest == 0))
					{
						snPtr = snPtr->NextBlock;
						continue;
					}
				}

				temNUM = (short) snPtr->rX;
				snPtr = snPtr->NextBlock;
				if (snPtr == bePtr) break;

				if (snPtr->rList == RECT_LST1)
				{
					alTest += (short) snPtr->rDir;
				}
				else
				{
					ahTest += (short) snPtr->rDir;
				}

				edgeState = (ahTest << 8) + alTest;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -