"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/SplashOutputDev.cc" between
xpdf-4.03.tar.gz and xpdf-4.04.tar.gz

About: Xpdf is a PDF viewer for X.

SplashOutputDev.cc  (xpdf-4.03):SplashOutputDev.cc  (xpdf-4.04)
skipping to change at line 1877 skipping to change at line 1877
if (tilingType == 2 || idet == 0) { if (tilingType == 2 || idet == 0) {
adjXMin = tileXMin; adjXMin = tileXMin;
adjYMin = tileYMin; adjYMin = tileYMin;
sx = 1; sx = 1;
sy = 1; sy = 1;
} else { } else {
// reposition the pattern origin to the center of the clipping bbox // reposition the pattern origin to the center of the clipping bbox
idet = 1 / idet; idet = 1 / idet;
clipXC = 0.5 * (clipXMin + clipXMax); clipXC = 0.5 * (clipXMin + clipXMax);
clipYC = 0.5 * (clipYMin + clipYMax); clipYC = 0.5 * (clipYMin + clipYMax);
ix = (int)((yStepX * (tileYMin - clipYC) - (tileXMin - clipXC) * yStepY) ix = (int)floor((yStepX * (tileYMin - clipYC)
* idet + 0.5); - (tileXMin - clipXC) * yStepY) * idet + 0.5);
iy = (int)((xStepX * (clipYC - tileYMin) - (clipXC - tileXMin) * xStepY) iy = (int)floor((xStepX * (clipYC - tileYMin)
* idet + 0.5); - (clipXC - tileXMin) * xStepY) * idet + 0.5);
adjXMin = (int)floor(tileXMin + ix * xStepX + iy * yStepX + 0.5); adjXMin = (int)floor(tileXMin + ix * xStepX + iy * yStepX + 0.5);
adjYMin = (int)floor(tileYMin + ix * xStepY + iy * yStepY + 0.5); adjYMin = (int)floor(tileYMin + ix * xStepY + iy * yStepY + 0.5);
sx = tileW / (tileXMax - tileXMin); sx = tileW / (tileXMax - tileXMin);
sy = tileH / (tileYMax - tileYMin); sy = tileH / (tileYMax - tileYMin);
xStepX = (int)floor(sx * xStepX + 0.5); xStepX = (int)floor(sx * xStepX + 0.5);
xStepY = (int)floor(sy * xStepY + 0.5); xStepY = (int)floor(sy * xStepY + 0.5);
yStepX = (int)floor(sx * yStepX + 0.5); yStepX = (int)floor(sx * yStepX + 0.5);
yStepY = (int)floor(sy * yStepY + 0.5); yStepY = (int)floor(sy * yStepY + 0.5);
} }
// compute tile matrix = PTM * BTM * Mtranslate * Mscale * iCTM
// = mat * CTM * Mtranslate * Mscale * iCTM
ctm = state->getCTM();
idet = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
ictm[0] = ctm[3] * idet;
ictm[1] = -ctm[1] * idet;
ictm[2] = -ctm[2] * idet;
ictm[3] = ctm[0] * idet;
ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * idet;
ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * idet;
// mat * CTM
mat1[0] = mat[0] * ctm[0] + mat[1] * ctm[2];
mat1[1] = mat[0] * ctm[1] + mat[1] * ctm[3];
mat1[2] = mat[2] * ctm[0] + mat[3] * ctm[2];
mat1[3] = mat[2] * ctm[1] + mat[3] * ctm[3];
mat1[4] = mat[4] * ctm[0] + mat[5] * ctm[2] + ctm[4];
mat1[5] = mat[4] * ctm[1] + mat[5] * ctm[3] + ctm[5];
// mat * CTM * (Mtranslate * Mscale)
mat2[0] = mat1[0] * sx;
mat2[1] = mat1[1] * sy;
mat2[2] = mat1[2] * sx;
mat2[3] = mat1[3] * sy;
mat2[4] = mat1[4] * sx - sx * tileXMin;
mat2[5] = mat1[5] * sy - sy * tileYMin;
// mat * CTM * (Mtranslate * Mscale) * iCTM
tileMat[0] = mat2[0] * ictm[0] + mat2[1] * ictm[2];
tileMat[1] = mat2[0] * ictm[1] + mat2[1] * ictm[3];
tileMat[2] = mat2[2] * ictm[0] + mat2[3] * ictm[2];
tileMat[3] = mat2[2] * ictm[1] + mat2[3] * ictm[3];
tileMat[4] = mat2[4] * ictm[0] + mat2[5] * ictm[2] + ictm[4];
tileMat[5] = mat2[4] * ictm[1] + mat2[5] * ictm[3] + ictm[5];
// compute tiling range: // compute tiling range:
// - look at the four corners of the clipping bbox // - look at the four corners of the clipping bbox
// - solve for the (ix,iy) tile position at each corner // - solve for the (ix,iy) tile position at each corner
// - take the min and max values for ix, iy // - take the min and max values for ix, iy
idet = xStepX * yStepY - xStepY * yStepX; idet = xStepX * yStepY - xStepY * yStepX;
if (idet == 0) { if (idet == 0) {
return; return;
} }
idet = 1 / idet; idet = 1 / idet;
// LL corner // LL corner
skipping to change at line 1984 skipping to change at line 1952
if (tx < txMin) { if (tx < txMin) {
txMin = tx; txMin = tx;
} else if (tx > txMax) { } else if (tx > txMax) {
txMax = tx; txMax = tx;
} }
if (ty < tyMin) { if (ty < tyMin) {
tyMin = ty; tyMin = ty;
} else if (ty > tyMax) { } else if (ty > tyMax) {
tyMax = ty; tyMax = ty;
} }
ixMin = (int)floor(txMin); ixMin = (int)ceil(txMin);
ixMax = (int)ceil(txMax); ixMax = (int)floor(txMax) + 1;
iyMin = (int)floor(tyMin); iyMin = (int)ceil(tyMin);
iyMax = (int)ceil(tyMax); iyMax = (int)floor(tyMax) + 1;
// special case: pattern tile is larger than clipping bbox
if (ixMax - ixMin == 1 && iyMax - iyMin == 1) {
// reduce the tile size to just the clipping bbox -- this improves
// performance in cases where just a small portion of one tile is
// needed
tileW = (int)(clipXMax - clipXMin + 0.5);
tileH = (int)(clipYMax - clipYMin + 0.5);
if (tileW < 1) {
tileW = 1;
}
if (tileH < 1) {
tileH = 1;
}
tileXMin += clipXMin - (adjXMin + ixMin * xStepX + iyMin * yStepX);
tileYMin += clipYMin - (adjYMin + ixMin * xStepY + iyMin * yStepY);
ixMin = 0;
iyMin = 0;
ixMax = 1;
iyMax = 1;
adjXMin = clipXMin;
adjYMin = clipYMin;
}
// compute tile matrix = PTM * BTM * Mtranslate * Mscale * iCTM
// = mat * CTM * Mtranslate * Mscale * iCTM
ctm = state->getCTM();
idet = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]);
ictm[0] = ctm[3] * idet;
ictm[1] = -ctm[1] * idet;
ictm[2] = -ctm[2] * idet;
ictm[3] = ctm[0] * idet;
ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * idet;
ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * idet;
// mat * CTM
mat1[0] = mat[0] * ctm[0] + mat[1] * ctm[2];
mat1[1] = mat[0] * ctm[1] + mat[1] * ctm[3];
mat1[2] = mat[2] * ctm[0] + mat[3] * ctm[2];
mat1[3] = mat[2] * ctm[1] + mat[3] * ctm[3];
mat1[4] = mat[4] * ctm[0] + mat[5] * ctm[2] + ctm[4];
mat1[5] = mat[4] * ctm[1] + mat[5] * ctm[3] + ctm[5];
// mat * CTM * (Mtranslate * Mscale)
mat2[0] = mat1[0] * sx;
mat2[1] = mat1[1] * sy;
mat2[2] = mat1[2] * sx;
mat2[3] = mat1[3] * sy;
mat2[4] = mat1[4] * sx - sx * tileXMin;
mat2[5] = mat1[5] * sy - sy * tileYMin;
// mat * CTM * (Mtranslate * Mscale) * iCTM
tileMat[0] = mat2[0] * ictm[0] + mat2[1] * ictm[2];
tileMat[1] = mat2[0] * ictm[1] + mat2[1] * ictm[3];
tileMat[2] = mat2[2] * ictm[0] + mat2[3] * ictm[2];
tileMat[3] = mat2[2] * ictm[1] + mat2[3] * ictm[3];
tileMat[4] = mat2[4] * ictm[0] + mat2[5] * ictm[2] + ictm[4];
tileMat[5] = mat2[4] * ictm[1] + mat2[5] * ictm[3] + ictm[5];
// create a temporary bitmap // create a temporary bitmap
origBitmap = bitmap; origBitmap = bitmap;
origSplash = splash; origSplash = splash;
traceMessage("tiling pattern bitmap"); traceMessage("tiling pattern bitmap");
bitmap = tileBitmap = new SplashBitmap(tileW, tileH, bitmapRowPad, bitmap = tileBitmap = new SplashBitmap(tileW, tileH, bitmapRowPad,
colorMode, gTrue, bitmapTopDown, colorMode, gTrue, bitmapTopDown,
origBitmap); origBitmap);
splash = new Splash(bitmap, vectorAntialias, splash = new Splash(bitmap, vectorAntialias,
origSplash->getImageCache(), origSplash->getScreen()); origSplash->getImageCache(), origSplash->getScreen());
skipping to change at line 2063 skipping to change at line 2086
iyMax = (int)floor(clipYMax) + 1; iyMax = (int)floor(clipYMax) + 1;
for (iy = iyMin; iy < iyMax; ++iy) { for (iy = iyMin; iy < iyMax; ++iy) {
for (ix = ixMin; ix < ixMax; ++ix) { for (ix = ixMin; ix < ixMax; ++ix) {
splash->composite(tileBitmap, 0, 0, ix, iy, tileW, tileH, splash->composite(tileBitmap, 0, 0, ix, iy, tileW, tileH,
gFalse, gFalse); gFalse, gFalse);
} }
} }
} else { } else {
for (iy = iyMin; iy < iyMax; ++iy) { for (iy = iyMin; iy < iyMax; ++iy) {
for (ix = ixMin; ix < ixMax; ++ix) { for (ix = ixMin; ix < ixMax; ++ix) {
x = (int)(adjXMin + ix * xStepX + iy * yStepX + 0.5); x = (int)floor(adjXMin + ix * xStepX + iy * yStepX + 0.5);
y = (int)(adjYMin + ix * xStepY + iy * yStepY + 0.5); y = (int)floor(adjYMin + ix * xStepY + iy * yStepY + 0.5);
if (overprintMaskBitmap) { if (overprintMaskBitmap) {
splash->compositeWithOverprint(tileBitmap, overprintMaskBitmap, splash->compositeWithOverprint(tileBitmap, overprintMaskBitmap,
0, 0, x, y, tileW, tileH, 0, 0, x, y, tileW, tileH,
gFalse, gFalse); gFalse, gFalse);
} else { } else {
splash->composite(tileBitmap, 0, 0, x, y, tileW, tileH, splash->composite(tileBitmap, 0, 0, x, y, tileW, tileH,
gFalse, gFalse); gFalse, gFalse);
} }
} }
} }
skipping to change at line 2717 skipping to change at line 2740
imgMaskData.imgStr = new ImageStream(str, width, 1, 1); imgMaskData.imgStr = new ImageStream(str, width, 1, 1);
imgMaskData.imgStr->reset(); imgMaskData.imgStr->reset();
imgMaskData.invert = invert ? 0 : 1; imgMaskData.invert = invert ? 0 : 1;
imgMaskData.width = width; imgMaskData.width = width;
imgMaskData.height = height; imgMaskData.height = height;
imgMaskData.y = 0; imgMaskData.y = 0;
imgTag = makeImageTag(ref, gfxRenderingIntentRelativeColorimetric, NULL); imgTag = makeImageTag(ref, gfxRenderingIntentRelativeColorimetric, NULL);
splash->fillImageMask(imgTag, splash->fillImageMask(imgTag,
&imageMaskSrc, &imgMaskData, width, height, mat, &imageMaskSrc, &imgMaskData, width, height, mat,
t3GlyphStack != NULL, interpolate); t3GlyphStack != NULL, interpolate,
globalParams->getImageMaskAntialias());
if (inlineImg) { if (inlineImg) {
while (imgMaskData.y < height) { while (imgMaskData.y < height) {
imgMaskData.imgStr->getLine(); imgMaskData.imgStr->getLine();
++imgMaskData.y; ++imgMaskData.y;
} }
} }
delete imgTag; delete imgTag;
delete imgMaskData.imgStr; delete imgMaskData.imgStr;
skipping to change at line 2767 skipping to change at line 2791
imgMaskData.height = height; imgMaskData.height = height;
imgMaskData.y = 0; imgMaskData.y = 0;
traceMessage("image mask soft mask bitmap"); traceMessage("image mask soft mask bitmap");
maskBitmap = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), maskBitmap = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(),
1, splashModeMono8, gFalse, gTrue, bitmap); 1, splashModeMono8, gFalse, gTrue, bitmap);
maskSplash = new Splash(maskBitmap, gTrue, splash->getImageCache()); maskSplash = new Splash(maskBitmap, gTrue, splash->getImageCache());
maskSplash->setStrokeAdjust( maskSplash->setStrokeAdjust(
mapStrokeAdjustMode[globalParams->getStrokeAdjust()]); mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
maskSplash->setEnablePathSimplification( maskSplash->setEnablePathSimplification(
globalParams->getEnablePathSimplification()); globalParams->getEnablePathSimplification());
if (splash->getSoftMask()) {
maskSplash->setSoftMask(splash->getSoftMask(), gFalse);
}
clearMaskRegion(state, maskSplash, 0, 0, 1, 1); clearMaskRegion(state, maskSplash, 0, 0, 1, 1);
maskColor[0] = 0xff; maskColor[0] = 0xff;
maskSplash->setFillPattern(new SplashSolidColor(maskColor)); maskSplash->setFillPattern(new SplashSolidColor(maskColor));
imgTag = makeImageTag(ref, gfxRenderingIntentRelativeColorimetric, NULL); imgTag = makeImageTag(ref, gfxRenderingIntentRelativeColorimetric, NULL);
maskSplash->fillImageMask(imgTag, &imageMaskSrc, &imgMaskData, maskSplash->fillImageMask(imgTag, &imageMaskSrc, &imgMaskData,
width, height, mat, gFalse, interpolate); width, height, mat, gFalse, interpolate,
globalParams->getImageMaskAntialias());
delete imgTag; delete imgTag;
delete imgMaskData.imgStr; delete imgMaskData.imgStr;
str->close(); str->close();
delete maskSplash; delete maskSplash;
splash->setSoftMask(maskBitmap); splash->setSoftMask(maskBitmap);
} }
struct SplashOutImageData { struct SplashOutImageData {
ImageStream *imgStr; ImageStream *imgStr;
GfxImageColorMap *colorMap; GfxImageColorMap *colorMap;
skipping to change at line 3266 skipping to change at line 3294
maskSplash->setStrokeAdjust( maskSplash->setStrokeAdjust(
mapStrokeAdjustMode[globalParams->getStrokeAdjust()]); mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
maskSplash->setEnablePathSimplification( maskSplash->setEnablePathSimplification(
globalParams->getEnablePathSimplification()); globalParams->getEnablePathSimplification());
maskColor[0] = 0; maskColor[0] = 0;
maskSplash->clear(maskColor); maskSplash->clear(maskColor);
maskColor[0] = 0xff; maskColor[0] = 0xff;
maskSplash->setFillPattern(new SplashSolidColor(maskColor)); maskSplash->setFillPattern(new SplashSolidColor(maskColor));
// use "glyph mode" here to get the correct scaled size // use "glyph mode" here to get the correct scaled size
maskSplash->fillImageMask(NULL, &imageMaskSrc, &imgMaskData, maskSplash->fillImageMask(NULL, &imageMaskSrc, &imgMaskData,
maskWidth, maskHeight, mat, gTrue, interpolate); maskWidth, maskHeight, mat, gTrue, interpolate,
globalParams->getImageMaskAntialias());
delete imgMaskData.imgStr; delete imgMaskData.imgStr;
maskStr->close(); maskStr->close();
delete maskSplash; delete maskSplash;
//----- draw the source image //----- draw the source image
mat[0] = ctm[0]; mat[0] = ctm[0];
mat[1] = ctm[1]; mat[1] = ctm[1];
mat[2] = -ctm[2]; mat[2] = -ctm[2];
mat[3] = -ctm[3]; mat[3] = -ctm[3];
skipping to change at line 3809 skipping to change at line 3838
p += xxMinI; p += xxMinI;
} }
if (xxMaxI > xxMinI) { if (xxMaxI > xxMinI) {
for (y = yyMinI; y < yyMaxI; ++y) { for (y = yyMinI; y < yyMaxI; ++y) {
memset(p, 0, n); memset(p, 0, n);
p += maskBitmap->getRowSize(); p += maskBitmap->getRowSize();
} }
} }
} }
void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, GBool SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox,
GfxColorSpace *blendingColorSpace, GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout, GBool isolated, GBool knockout,
GBool forSoftMask) { GBool forSoftMask) {
SplashTransparencyGroup *transpGroup; SplashTransparencyGroup *transpGroup;
SplashBitmap *backdropBitmap; SplashBitmap *backdropBitmap;
SplashColor color; SplashColor color;
double xMin, yMin, xMax, yMax, x, y; double xMin, yMin, xMax, yMax, x, y;
int bw, bh, tx, ty, w, h, i; int bw, bh, tx, ty, w, h, i;
// transform the bbox // transform the bbox
state->transform(bbox[0], bbox[1], &x, &y); state->transform(bbox[0], bbox[1], &x, &y);
xMin = xMax = x; xMin = xMax = x;
yMin = yMax = y; yMin = yMax = y;
skipping to change at line 3907 skipping to change at line 3936
} }
h = (int)ceil(yMax) - ty + 1; h = (int)ceil(yMax) - ty + 1;
// NB bh and ty are both non-negative, so 'bh - ty' can't overflow // NB bh and ty are both non-negative, so 'bh - ty' can't overflow
if (bh - ty < h) { if (bh - ty < h) {
h = bh - ty; h = bh - ty;
} }
if (h < 1) { if (h < 1) {
h = 1; h = 1;
} }
// optimization: a non-isolated group drawn with alpha=1 and
// Blend=Normal and backdrop alpha=0 is equivalent to drawing
// directly onto the backdrop (i.e., a regular non-t-group Form)
// notes:
// - if we are already in a non-isolated group, it means the
// backdrop alpha is non-zero (otherwise the parent non-isolated
// group would have been optimized away)
// - if there is a soft mask in place, then source alpha is not 1
// (i.e., source alpha = fillOpacity * softMask)
// - both the parent and child groups must be non-knockout
if (!isolated &&
!splash->getInNonIsolatedGroup() &&
!knockout &&
!splash->getInKnockoutGroup() &&
!forSoftMask &&
!splash->getSoftMask() &&
state->getFillOpacity() == 1 &&
state->getBlendMode() == gfxBlendNormal &&
splash->checkTransparentRect(tx, ty, w, h)) {
return gFalse;
}
// push a new stack entry // push a new stack entry
transpGroup = new SplashTransparencyGroup(); transpGroup = new SplashTransparencyGroup();
transpGroup->tx = tx; transpGroup->tx = tx;
transpGroup->ty = ty; transpGroup->ty = ty;
transpGroup->blendingColorSpace = blendingColorSpace; transpGroup->blendingColorSpace = blendingColorSpace;
transpGroup->isolated = isolated; transpGroup->isolated = isolated;
transpGroup->next = transpGroupStack; transpGroup->next = transpGroupStack;
transpGroupStack = transpGroup; transpGroupStack = transpGroup;
// save state // save state
skipping to change at line 4033 skipping to change at line 4084
splash->clearModRegion(); splash->clearModRegion();
transpGroup->tBitmap = bitmap; transpGroup->tBitmap = bitmap;
#if 1 //~tmp #if 1 //~tmp
if (knockout) { if (knockout) {
splash->setInShading(gTrue); splash->setInShading(gTrue);
} }
#endif #endif
state->shiftCTM(-tx, -ty); state->shiftCTM(-tx, -ty);
updateCTM(state, 0, 0, 0, 0, 0, 0); updateCTM(state, 0, 0, 0, 0, 0, 0);
++nestCount; ++nestCount;
return gTrue;
} }
void SplashOutputDev::endTransparencyGroup(GfxState *state) { void SplashOutputDev::endTransparencyGroup(GfxState *state) {
splash->getModRegion(&transpGroupStack->modXMin, &transpGroupStack->modYMin, splash->getModRegion(&transpGroupStack->modXMin, &transpGroupStack->modYMin,
&transpGroupStack->modXMax, &transpGroupStack->modYMax); &transpGroupStack->modXMax, &transpGroupStack->modYMax);
// restore state // restore state
--nestCount; --nestCount;
delete splash; delete splash;
bitmap = transpGroupStack->origBitmap; bitmap = transpGroupStack->origBitmap;
 End of changes. 11 change blocks. 
49 lines changed or deleted 102 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)