xserver/hw/xgl xglglyph.c,1.4,1.5

David Reveman xserver-commit at pdx.freedesktop.org
Sun May 1 15:55:27 PDT 2005


Committed by: davidr

Update of /cvs/xserver/xserver/hw/xgl
In directory gabe:/tmp/cvs-serv26038/hw/xgl

Modified Files:
	xglglyph.c 
Log Message:
New algorithm for calculating glyph extents in Xgl

Index: xglglyph.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/xgl/xglglyph.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- xglglyph.c	13 Apr 2005 14:27:47 -0000	1.4
+++ xglglyph.c	1 May 2005 22:55:25 -0000	1.5
@@ -844,15 +844,21 @@
 		 BoxPtr	      extents)
 {
     GlyphPtr glyph;
+    BoxRec   line;
     int	     x1, x2, y1, y2;
     int	     n;
     int	     x;
     int	     y;
-    Bool     x_overlap, overlap = FALSE;
+    Bool     overlap = FALSE;
 
     x = 0;
     y = 0;
 
+    extents->x1 = MAXSHORT;
+    extents->x2 = MINSHORT;
+    extents->y1 = MAXSHORT;
+    extents->y2 = MINSHORT;    
+
     while (!list->len)
     {
 	if (--nlist)
@@ -863,11 +869,6 @@
 	}
 	else
 	{
-	    extents->x1 = MAXSHORT;
-	    extents->x2 = MINSHORT;
-	    extents->y1 = MAXSHORT;
-	    extents->y2 = MINSHORT;
-	    
 	    return FALSE;
 	}
     }
@@ -880,10 +881,10 @@
     if (y1 < MINSHORT)
 	y1 = MINSHORT;
 
-    extents->x1 = x1;
-    extents->x2 = x1;
-    extents->y1 = y1;
-    extents->y2 = y1;
+    line.x1 = x1;
+    line.x2 = x1;
+    line.y1 = y1;
+    line.y2 = y1;
 
     while (nlist--)
     {
@@ -908,33 +909,55 @@
 	    if (y2 > MAXSHORT)
 		y2 = MAXSHORT;
 
-	    x_overlap = FALSE;
-	    if (x1 >= extents->x2)
-		extents->x2 = x2;
-	    else if (x2 <= extents->x1)
-		extents->x1 = x1;
-	    else
+	    if (x1 >= line.x2)
 	    {
-		x_overlap = TRUE;
-		if (x1 < extents->x1)
-		    extents->x1 = x1;
-		if (x2 > extents->x2)
-		    extents->x2 = x2;
+		line.x2 = x2;
+		if (y1 < line.y1)
+		    line.y1 = y1;
+		if (y2 > line.y2)
+		    line.y2 = y2;
+	    }
+	    else if (x2 <= line.x1)
+	    {
+		line.x1 = x1;
+		if (y1 < line.y1)
+		    line.y1 = y1;
+		if (y2 > line.y2)
+		    line.y2 = y2;
 	    }
-
-	    if (y1 >= extents->y2)
-		extents->y2 = y2;
-	    else if (y2 <= extents->y1)
-		extents->y1 = y1;	    
 	    else
 	    {
-		if (y1 < extents->y1)
-		    extents->y1 = y1;
-		if (y2 > extents->y2)
-		    extents->y2 = y2;
-
-		if (x_overlap)
+		if (line.y1 >= extents->y2)
+		{
+		    extents->y2 = line.y2;
+		    if (line.y1 < extents->y1)
+			extents->y1 = line.y1;
+		}
+		else if (line.y2 <= extents->y1)
+		{
+		    extents->y1 = line.y1;
+		    if (line.y2 > extents->y2)
+			extents->y2 = line.y2;
+		}
+		else
+		{
+		    if (line.y1 < extents->y1)
+			extents->y1 = line.y1;
+		    if (line.y2 > extents->y2)
+			extents->y2 = line.y2;
+		
 		    overlap = TRUE;
+		}
+
+		if (line.x1 < extents->x1)
+		    extents->x1 = line.x1;
+		if (line.x2 > extents->x2)
+		    extents->x2 = line.x2;
+
+		line.x1 = x1;
+		line.y1 = y1;
+		line.x2 = x2;
+		line.y2 = y2;
 	    }
 	    
 	    x += glyph->info.xOff;
@@ -942,6 +965,33 @@
 	}
     }
 
+    if (line.y1 >= extents->y2)
+    {
+	extents->y2 = line.y2;
+	if (line.y1 < extents->y1)
+	    extents->y1 = line.y1;
+    }
+    else if (line.y2 <= extents->y1)
+    {
+	extents->y1 = line.y1;
+	if (line.y2 > extents->y2)
+	    extents->y2 = line.y2;
+    }
+    else
+    {
+	if (line.y1 < extents->y1)
+	    extents->y1 = line.y1;
+	if (line.y2 > extents->y2)
+	    extents->y2 = line.y2;
+	
+	overlap = TRUE;
+    }
+    
+    if (line.x1 < extents->x1)
+	extents->x1 = line.x1;
+    if (line.x2 > extents->x2)
+	extents->x2 = line.x2;
+    
     xglPictureClipExtents (pDst, extents);
 
     return overlap;



More information about the xserver-commit mailing list