fixed compiler warning
[swftools.git] / lib / pdf / BitmapOutputDev.cc
index e551fd6..43fb89a 100644 (file)
@@ -440,6 +440,16 @@ static void clearBooleanBitmap(SplashBitmap*btm)
     }
 }
 
+long long unsigned int compare64(long long unsigned int*data1, long long unsigned int*data2, int len)
+{
+    long long unsigned int c;
+    int t;
+    for(t=0;t<len;t++) {
+        c |= data1[t]&data2[t];
+    }
+    return c;
+}
+
 GBool BitmapOutputDev::intersection()
 {
     SplashBitmap*boolpoly = boolpolybitmap;
@@ -457,17 +467,18 @@ GBool BitmapOutputDev::intersection()
        
        int t;
        int len = height*width8;
-       unsigned int c=0;
-       if(len & (sizeof(unsigned int)-1)) {
-           Guchar c2=0;
-           for(t=0;t<len;t++) {
-               c2 |= polypixels[t]&textpixels[t];
-           }
-           c = c2;
-       } else {
-           len /= sizeof(unsigned int);
-           for(t=0;t<len;t++) {
-               c |= (((unsigned int*)polypixels)[t]) & (((unsigned int*)textpixels)[t]);
+       unsigned long long int c=0;
+        assert(sizeof(unsigned long long int)==8);
+       {
+            if(((int)polypixels&7) || ((int)textpixels&7)) {
+                msg("<warning> Non-optimal alignment");
+            }
+            int l2 = len;
+           len /= sizeof(unsigned long long int);
+            c = compare64((unsigned long long int*)polypixels, (unsigned long long int*)textpixels, len);
+            int l1 = len*sizeof(unsigned long long int);
+           for(t=l1;t<l2;t++) {
+               c |= (unsigned long long int)(polypixels[t]&textpixels[t]);
            }
        }
        if(c)
@@ -552,6 +563,13 @@ void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, do
 void BitmapOutputDev::endPage()
 {
     msg("<verbose> endPage (BitmapOutputDev)");
+
+    /* notice: we're not fully done yet with this page- there might still be 
+       a few calls to drawLink() yet to come */
+}
+void BitmapOutputDev::finishPage()
+{
+    msg("<verbose> finishPage (BitmapOutputDev)");
     gfxdev->endPage();
    
     if(layerstate == STATE_BITMAP_IS_ABOVE) {
@@ -569,9 +587,6 @@ void BitmapOutputDev::endPage()
     rgbdev->endPage();
     clip0dev->endPage();
     clip1dev->endPage();
-
-    /* notice: we're not fully done yet with this page- there might still be 
-       a few calls to drawLink() yet to come */
 }
 
 GBool BitmapOutputDev::upsideDown()