applied diff between xpdf-1.01-orig and xpdf-1.01-swftools.
authorkramm <kramm>
Fri, 17 Sep 2004 16:39:03 +0000 (16:39 +0000)
committerkramm <kramm>
Fri, 17 Sep 2004 16:39:03 +0000 (16:39 +0000)
pdf2swf/xpdf/Gfx.cc
pdf2swf/xpdf/GfxFont.h
pdf2swf/xpdf/GfxState.cc

index a52aa02..4f9142c 100644 (file)
@@ -424,7 +424,7 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict,
   fontChanged = gFalse;
   clip = clipNone;
   ignoreUndef = 0;
-  out->startPage(pageNum, state);
+  out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2);
   out->setDefaultCTM(state->getCTM());
   out->updateAll(state);
   for (i = 0; i < 6; ++i) {
@@ -435,7 +435,7 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict,
   abortCheckCbkData = abortCheckCbkDataA;
 
   // set crop box
-  if (crop) {
+  /*if (crop) {
     state->moveTo(cropBox->x1, cropBox->y1);
     state->lineTo(cropBox->x2, cropBox->y1);
     state->lineTo(cropBox->x2, cropBox->y2);
@@ -444,7 +444,7 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict,
     state->clip();
     out->clip(state);
     state->clearPath();
-  }
+  }*/
 }
 
 Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
index 62dfd08..df1e00c 100644 (file)
@@ -207,7 +207,7 @@ public:
   CharCodeToUnicode *getToUnicode();
 
   // Return the character name associated with <code>.
-  char *getCharName(int code) { return enc[code]; }
+  char *getCharName(int code) { return code>=256?0:enc[code]; }
 
   // Returns true if the PDF font specified an encoding.
   GBool getHasEncoding() { return hasEncoding; }
index 65a1da8..5aa9c28 100644 (file)
@@ -1983,12 +1983,14 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
   double x[gfxColorMaxComps];
   double y[gfxColorMaxComps];
   int i, j, k;
+  int maxPixelForAlloc;
 
   ok = gTrue;
 
   // bits per component and color space
   bits = bitsA;
   maxPixel = (1 << bits) - 1;
+  maxPixelForAlloc = (1 << (bits>8?bits:8));
   colorSpace = colorSpaceA;
 
   // get decode map
@@ -2035,7 +2037,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
     colorSpace2 = indexedCS->getBase();
     indexHigh = indexedCS->getIndexHigh();
     nComps2 = colorSpace2->getNComps();
-    lookup = (double *)gmalloc((maxPixel + 1) * nComps2 * sizeof(double));
+    lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps2 * sizeof(double));
     lookup2 = indexedCS->getLookup();
     colorSpace2->getDefaultRanges(x, y, indexHigh);
     for (i = 0; i <= maxPixel; ++i) {
@@ -2053,7 +2055,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
     sepCS = (GfxSeparationColorSpace *)colorSpace;
     colorSpace2 = sepCS->getAlt();
     nComps2 = colorSpace2->getNComps();
-    lookup = (double *)gmalloc((maxPixel + 1) * nComps2 * sizeof(double));
+    lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps2 * sizeof(double));
     sepFunc = sepCS->getFunc();
     for (i = 0; i <= maxPixel; ++i) {
       x[0] = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
@@ -2063,7 +2065,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
       }
     }
   } else {
-    lookup = (double *)gmalloc((maxPixel + 1) * nComps * sizeof(double));
+    lookup = (double *)gmalloc((maxPixelForAlloc + 1) * nComps * sizeof(double));
     for (i = 0; i <= maxPixel; ++i) {
       for (k = 0; k < nComps; ++k) {
        lookup[i*nComps + k] = decodeLow[k] +