[poppler] poppler/splash: SplashXPathScanner.cc,1.2,1.3

Albert Astals Cid aacid at freedesktop.org
Sun Oct 16 07:19:49 PDT 2005


Update of /cvs/poppler/poppler/splash
In directory gabe:/tmp/cvs-serv23662/splash

Modified Files:
	SplashXPathScanner.cc 
Log Message:
Merging SplashXPathScanner.cc changes from xpdf 3.01


Index: SplashXPathScanner.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashXPathScanner.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- SplashXPathScanner.cc	27 Aug 2005 08:43:43 -0000	1.2
+++ SplashXPathScanner.cc	16 Oct 2005 14:19:47 -0000	1.3
@@ -40,53 +40,57 @@
   eo = eoA;
 
   // compute the bbox
-  seg = &xPath->segs[0];
-  if (seg->x0 <= seg->x1) {
-    xMinFP = seg->x0;
-    xMaxFP = seg->x1;
-  } else {
-    xMinFP = seg->x1;
-    xMaxFP = seg->x0;
-  }
-  if (seg->flags & splashXPathFlip) {
-    yMinFP = seg->y1;
-    yMaxFP = seg->y0;
+  if (xPath->length == 0) {
+    xMin = yMin = 1;
+    xMax = yMax = 0;
   } else {
-    yMinFP = seg->y0;
-    yMaxFP = seg->y1;
-  }
-  for (i = 1; i < xPath->length; ++i) {
-    seg = &xPath->segs[i];
-    if (seg->x0 < xMinFP) {
+    seg = &xPath->segs[0];
+    if (seg->x0 <= seg->x1) {
       xMinFP = seg->x0;
-    } else if (seg->x0 > xMaxFP) {
-      xMaxFP = seg->x0;
-    }
-    if (seg->x1 < xMinFP) {
-      xMinFP = seg->x1;
-    } else if (seg->x1 > xMaxFP) {
       xMaxFP = seg->x1;
+    } else {
+      xMinFP = seg->x1;
+      xMaxFP = seg->x0;
     }
     if (seg->flags & splashXPathFlip) {
-      if (seg->y0 > yMaxFP) {
-	yMaxFP = seg->y0;
-      }
+      yMinFP = seg->y1;
+      yMaxFP = seg->y0;
     } else {
-      if (seg->y1 > yMaxFP) {
-	yMaxFP = seg->y1;
+      yMinFP = seg->y0;
+      yMaxFP = seg->y1;
+    }
+    for (i = 1; i < xPath->length; ++i) {
+      seg = &xPath->segs[i];
+      if (seg->x0 < xMinFP) {
+	xMinFP = seg->x0;
+      } else if (seg->x0 > xMaxFP) {
+	xMaxFP = seg->x0;
+      }
+      if (seg->x1 < xMinFP) {
+	xMinFP = seg->x1;
+      } else if (seg->x1 > xMaxFP) {
+	xMaxFP = seg->x1;
+      }
+      if (seg->flags & splashXPathFlip) {
+	if (seg->y0 > yMaxFP) {
+	  yMaxFP = seg->y0;
+	}
+      } else {
+	if (seg->y1 > yMaxFP) {
+	  yMaxFP = seg->y1;
+	}
       }
     }
+    xMin = splashFloor(xMinFP);
+    xMax = splashFloor(xMaxFP);
+    yMin = splashFloor(yMinFP);
+    yMax = splashFloor(yMaxFP);
   }
-  xMin = splashFloor(xMinFP);
-  xMax = splashFloor(xMaxFP);
-  yMin = splashFloor(yMinFP);
-  yMax = splashFloor(yMaxFP);
 
-  interY = 0;
+  interY = yMin - 1;
   xPathIdx = 0;
   inter = NULL;
   interLen = interSize = 0;
-  computeIntersections(yMin);
 }
 
 SplashXPathScanner::~SplashXPathScanner() {
@@ -234,14 +238,14 @@
     } else {
       if (ySegMin <= y) {
 	// intersection with top edge
-	xx0 = seg->x0 + (y - seg->y0) * seg->dxdy;
+	xx0 = seg->x0 + ((SplashCoord)y - seg->y0) * seg->dxdy;
       } else {
 	// x coord of segment endpoint with min y coord
 	xx0 = (seg->flags & splashXPathFlip) ? seg->x1 : seg->x0;
       }
       if (ySegMax >= y + 1) {
 	// intersection with bottom edge
-	xx1 = seg->x0 + (y + 1 - seg->y0) * seg->dxdy;
+	xx1 = seg->x0 + ((SplashCoord)y + 1 - seg->y0) * seg->dxdy;
       } else {
 	// x coord of segment endpoint with max y coord
 	xx1 = (seg->flags & splashXPathFlip) ? seg->x0 : seg->x1;
@@ -254,7 +258,9 @@
       inter[interLen].x0 = splashFloor(xx1);
       inter[interLen].x1 = splashFloor(xx0);
     }
-    if (ySegMin <= y && y < ySegMax && !(seg->flags & splashXPathHoriz)) {
+    if (ySegMin <= y &&
+	(SplashCoord)y < ySegMax &&
+	!(seg->flags & splashXPathHoriz)) {
       inter[interLen].count = eo ? 1
 	                         : (seg->flags & splashXPathFlip) ? 1 : -1;
     } else {



More information about the poppler mailing list