try it with 8-bit precision
This commit is contained in:
		
							parent
							
								
									cfc7519727
								
							
						
					
					
						commit
						d711df60bd
					
				@ -19,7 +19,7 @@ inline static BYTE line_clip_outcode(INT32 x, INT32 y, INT32 xmin, INT32 ymin, I
 | 
				
			|||||||
  return rc;
 | 
					  return rc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CPX 4  /* clipping precision in bits */
 | 
					#define CPX 8  /* clipping precision in bits */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ONE (1 << CPX)  /* constant for mathematics */
 | 
					#define ONE (1 << CPX)  /* constant for mathematics */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -69,29 +69,25 @@ static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	if (outcode1 & 0x8)
 | 
						if (outcode1 & 0x8)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  tmp = M(x2 - x1, D(ymin - y1, y2 - y1));
 | 
						  x1 += M(x2 - x1, D(ymin - y1, y2 - y1));
 | 
				
			||||||
	  x1 += tmp;
 | 
					 | 
				
			||||||
	  y1 = ymin;
 | 
						  y1 = ymin;
 | 
				
			||||||
	  Log(LDEBUG, "clipped against top to point (%d, %d), dx=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
						  Log(LDEBUG, "clipped against top to point (%d, %d), dx=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (outcode1 & 0x4)
 | 
						else if (outcode1 & 0x4)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  tmp = M(x2 - x1, D(ymax - ONE - y1, y2 - y1));
 | 
						  x1 += M(x2 - x1, D(ymax - ONE - y1, y2 - y1));
 | 
				
			||||||
	  x1 += tmp;
 | 
					 | 
				
			||||||
	  y1 = ymax - ONE;
 | 
						  y1 = ymax - ONE;
 | 
				
			||||||
	  Log(LDEBUG, "clipped against bottom to point (%d, %d), dx=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
						  Log(LDEBUG, "clipped against bottom to point (%d, %d), dx=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (outcode1 & 0x2)
 | 
						else if (outcode1 & 0x2)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  tmp = M(y2 - y1, D(xmax - ONE - x1, x2 - x1));
 | 
						  y1 += M(y2 - y1, D(xmax - ONE - x1, x2 - x1));
 | 
				
			||||||
	  y1 += tmp;
 | 
					 | 
				
			||||||
	  x1 = xmax - ONE;
 | 
						  x1 = xmax - ONE;
 | 
				
			||||||
	  Log(LDEBUG, "clipped against right to point (%d, %d), dy=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
						  Log(LDEBUG, "clipped against right to point (%d, %d), dy=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (outcode1 & 0x1)
 | 
						else if (outcode1 & 0x1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  tmp = M(y2 - y1, D(xmin - x1, x2 - x1));
 | 
						  y1 += M(y2 - y1, D(xmin - x1, x2 - x1));
 | 
				
			||||||
	  y1 += tmp;
 | 
					 | 
				
			||||||
	  x1 = xmin;
 | 
						  x1 = xmin;
 | 
				
			||||||
	  Log(LDEBUG, "clipped against left to point (%d, %d), dy=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
						  Log(LDEBUG, "clipped against left to point (%d, %d), dy=%d/%d", x1 >> CPX, y1 >> CPX, tmp >> CPX, tmp);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user