PSDRV_StretchDIBits should use logical co-ords.

Some versions of ghostscript seem to eat one too many characters of
image data. Add a '%' to the output file to work around this.
This commit is contained in:
Huw D M Davies 1999-06-12 06:37:05 +00:00 committed by Alexandre Julliard
parent 6f40d25ddc
commit 83d4560ca4
2 changed files with 9 additions and 7 deletions

View File

@ -125,6 +125,10 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
return FALSE;
}
xDst = XLPTODP(dc, xDst);
yDst = YLPTODP(dc, yDst);
widthDst = XLSTODS(dc, widthDst);
heightDst = YLSTODS(dc, heightDst);
switch(bpp) {
@ -138,7 +142,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
FIXME(psdrv, "This won't work...\n");
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc/8, widthSrc/8);
PSDRV_WriteGRestore(dc);
break;
case 4:
@ -151,7 +154,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
FIXME(psdrv, "This won't work...\n");
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc/2, widthSrc/2);
PSDRV_WriteGRestore(dc);
break;
case 8:
@ -162,7 +164,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc, widthSrc);
PSDRV_WriteGRestore(dc);
break;
case 15:
@ -175,7 +176,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits16(dc, (WORD *)ptr + xSrc, widthSrc);
PSDRV_WriteGRestore(dc);
break;
case 24:
@ -187,7 +187,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits24(dc, ptr + xSrc * 3, widthSrc);
PSDRV_WriteGRestore(dc);
break;
case 32:
@ -199,7 +198,6 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits32(dc, ptr + xSrc * 3, widthSrc);
PSDRV_WriteGRestore(dc);
break;
default:
@ -207,7 +205,10 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
return FALSE;
}
PSDRV_WriteSpool(dc, "%\n", 2); /* some versions of ghostscript seem to
eat one too many chars after the image
operator */
PSDRV_WriteGRestore(dc);
return TRUE;
}

View File

@ -299,6 +299,7 @@ extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number);
extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number);
extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number);
extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number);
extern int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch);