X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FGfxState.cc;h=fd22d473d04a2c11d1255df5794041022d8fa1ce;hp=65a1da8e411b7e8c5bfdf7b73db3bfa2391f985c;hb=6e1c1abf3d11350aff029147932e02aa83874783;hpb=c7432833fe3a6469d63fad135151a92e12877b94 diff --git a/pdf2swf/xpdf/GfxState.cc b/pdf2swf/xpdf/GfxState.cc index 65a1da8..fd22d47 100644 --- a/pdf2swf/xpdf/GfxState.cc +++ b/pdf2swf/xpdf/GfxState.cc @@ -434,6 +434,17 @@ void GfxDeviceCMYKColorSpace::getGray(GfxColor *color, double *gray) { - 0.114 * color->c[2]); } +/*void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { + double c,m,y,k,white; + c = color->c[0]; + m = color->c[1]; + y = color->c[2]; + k = color->c[3]; + white = 1.0 - k; + rgb->r = white - (c*white); + rgb->g = white - (m*white); + rgb->b = white - (y*white); +}*/ void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { double c, m, y, aw, ac, am, ay, ar, ag, ab; @@ -1983,12 +1994,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 +2048,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 +2066,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 +2076,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] +