Rework clipping so that the PS clip path is only set just before any

graphics output event. Doing it this way means we don't ever need to
call initclip which is a Good Thing.
This commit is contained in:
Huw Davies 2003-05-19 19:06:47 +00:00 committed by Alexandre Julliard
parent 11d09a8330
commit a45df5d991
8 changed files with 194 additions and 47 deletions

View File

@ -41,10 +41,12 @@ BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, D
switch(dwRop) { switch(dwRop) {
case PATCOPY: case PATCOPY:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y );
PSDRV_Brush(physDev, FALSE); PSDRV_Brush(physDev, FALSE);
PSDRV_WriteGRestore(physDev); PSDRV_WriteGRestore(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
case BLACKNESS: case BLACKNESS:
@ -52,6 +54,7 @@ BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, D
{ {
PSCOLOR pscol; PSCOLOR pscol;
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y );
PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ? PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ?
@ -59,6 +62,7 @@ BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, D
PSDRV_WriteSetColor(physDev, &pscol); PSDRV_WriteSetColor(physDev, &pscol);
PSDRV_WriteFill(physDev); PSDRV_WriteFill(physDev);
PSDRV_WriteGRestore(physDev); PSDRV_WriteGRestore(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
default: default:

View File

@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <assert.h>
#include "psdrv.h" #include "psdrv.h"
#include "winbase.h" #include "winbase.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -147,7 +149,57 @@ static BOOL PSDRV_WriteImageHeader(PSDRV_PDEVICE *physDev, const BITMAPINFO *inf
} }
PSDRV_WriteImageDict(physDev, info->bmiHeader.biBitCount, xDst, yDst, PSDRV_WriteImageDict(physDev, info->bmiHeader.biBitCount, xDst, yDst,
widthDst, heightDst, widthSrc, heightSrc, NULL); widthDst, heightDst, widthSrc, heightSrc, NULL, FALSE);
return TRUE;
}
/***************************************************************************
* PSDRV_WriteImageMaskHeader
*
* Helper for PSDRV_StretchDIBits
*
* We use the imagemask operator for 1bpp bitmaps since the output
* takes much less time for the printer to render.
*
* BUGS
* Uses level 2 PostScript
*/
static BOOL PSDRV_WriteImageMaskHeader(PSDRV_PDEVICE *physDev, const BITMAPINFO *info, INT xDst,
INT yDst, INT widthDst, INT heightDst,
INT widthSrc, INT heightSrc)
{
COLORREF map[2];
PSCOLOR bkgnd, foregnd;
int i;
assert(info->bmiHeader.biBitCount == 1);
for(i = 0; i < 2; i++) {
map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16;
}
/* We'll write the mask with -ve polarity so that
the foregnd color corresponds to a bit equal to
0 in the bitmap.
*/
PSDRV_CreateColor(physDev, &foregnd, map[0]);
PSDRV_CreateColor(physDev, &bkgnd, map[1]);
PSDRV_WriteGSave(physDev);
PSDRV_WriteNewPath(physDev);
PSDRV_WriteRectangle(physDev, xDst, yDst, widthDst, heightDst);
PSDRV_WriteSetColor(physDev, &bkgnd);
PSDRV_WriteFill(physDev);
PSDRV_WriteGRestore(physDev);
PSDRV_WriteSetColor(physDev, &foregnd);
PSDRV_WriteImageDict(physDev, 1, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc, NULL, TRUE);
return TRUE; return TRUE;
} }
@ -180,8 +232,8 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
widthbytes = get_dib_width_bytes(fullSrcWidth, bpp); widthbytes = get_dib_width_bytes(fullSrcWidth, bpp);
TRACE("full size=%ldx%ld bpp=%d compression=%d\n", fullSrcWidth, TRACE("full size=%ldx%ld bpp=%d compression=%d rop=%08lx\n", fullSrcWidth,
fullSrcHeight, bpp, compression); fullSrcHeight, bpp, compression, dwRop);
if(compression != BI_RGB) { if(compression != BI_RGB) {
@ -202,9 +254,12 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
switch(bpp) { switch(bpp) {
case 1: case 1:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); /* Use imagemask rather than image */
PSDRV_WriteImageMaskHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
if(xSrc & 7) if(xSrc & 7)
@ -214,6 +269,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
break; break;
case 4: case 4:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
@ -226,6 +282,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
break; break;
case 8: case 8:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
@ -237,6 +294,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
case 15: case 15:
case 16: case 16:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
@ -248,6 +306,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
break; break;
case 24: case 24:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
@ -259,6 +318,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
break; break;
case 32: case 32:
PSDRV_SetClip(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
@ -276,11 +336,6 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs
} }
PSDRV_WriteSpool(physDev, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */ PSDRV_WriteSpool(physDev, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */
PSDRV_WriteGRestore(physDev); PSDRV_WriteGRestore(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }

View File

@ -145,19 +145,20 @@ BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO)
switch (logbrush.lbStyle) { switch (logbrush.lbStyle) {
case BS_SOLID: case BS_SOLID:
PSDRV_SetBrush(physDev);
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_SetBrush(physDev);
PSDRV_Fill(physDev, EO); PSDRV_Fill(physDev, EO);
PSDRV_WriteGRestore(physDev); PSDRV_WriteGRestore(physDev);
break; break;
case BS_HATCHED: case BS_HATCHED:
PSDRV_WriteGSave(physDev);
PSDRV_SetBrush(physDev); PSDRV_SetBrush(physDev);
switch(logbrush.lbHatch) { switch(logbrush.lbHatch) {
case HS_VERTICAL: case HS_VERTICAL:
case HS_CROSS: case HS_CROSS:
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_Clip(physDev, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteHatch(physDev); PSDRV_WriteHatch(physDev);
PSDRV_WriteStroke(physDev); PSDRV_WriteStroke(physDev);
@ -167,7 +168,7 @@ BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO)
/* else fallthrough for HS_CROSS */ /* else fallthrough for HS_CROSS */
case HS_HORIZONTAL: case HS_HORIZONTAL:
PSDRV_WriteGSave(physDev); PSDRV_WriteGSave(physDev);
PSDRV_Clip(physDev, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteRotate(physDev, 90.0); PSDRV_WriteRotate(physDev, 90.0);
PSDRV_WriteHatch(physDev); PSDRV_WriteHatch(physDev);
@ -201,6 +202,7 @@ BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO)
ret = FALSE; ret = FALSE;
break; break;
} }
PSDRV_WriteGRestore(physDev);
break; break;
case BS_NULL: case BS_NULL:

View File

@ -28,6 +28,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
* PSDRV_SetDeviceClipping * PSDRV_SetDeviceClipping
*/ */
VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev, HRGN ignored ) VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev, HRGN ignored )
{
/* We could set a dirty flag here to speed up PSDRV_SetClip */
return;
}
/***********************************************************************
* PSDRV_SetClip
*
* The idea here is that every graphics operation should bracket
* output in PSDRV_SetClip/ResetClip calls. The clip path outside
* these calls will be empty; the reason for this is that it is
* impossible in PostScript to cleanly make the clip path larger than
* the current one. Also Photoshop assumes that despite having set a
* small clip area in the printer dc that it can still write raw
* PostScript to the driver and expect this code not to be clipped.
*/
void PSDRV_SetClip( PSDRV_PDEVICE *physDev )
{ {
CHAR szArrayName[] = "clippath"; CHAR szArrayName[] = "clippath";
DWORD size; DWORD size;
@ -39,9 +56,6 @@ VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev, HRGN ignored )
empty = !GetClipRgn(physDev->hdc, hrgn); empty = !GetClipRgn(physDev->hdc, hrgn);
/* We really shouldn't be using initclip */
PSDRV_WriteInitClip(physDev);
if(!empty) { if(!empty) {
size = GetRegionData(hrgn, 0, NULL); size = GetRegionData(hrgn, 0, NULL);
if(!size) { if(!size) {
@ -57,6 +71,8 @@ VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev, HRGN ignored )
GetRegionData(hrgn, size, rgndata); GetRegionData(hrgn, size, rgndata);
PSDRV_WriteGSave(physDev);
/* check for NULL region */ /* check for NULL region */
if (rgndata->rdh.nCount == 0) if (rgndata->rdh.nCount == 0)
{ {
@ -97,3 +113,18 @@ end:
if(rgndata) HeapFree( GetProcessHeap(), 0, rgndata ); if(rgndata) HeapFree( GetProcessHeap(), 0, rgndata );
DeleteObject(hrgn); DeleteObject(hrgn);
} }
/***********************************************************************
* PSDRV_ResetClip
*/
void PSDRV_ResetClip( PSDRV_PDEVICE *physDev )
{
HRGN hrgn = CreateRectRgn(0,0,0,0);
BOOL empty;
empty = !GetClipRgn(physDev->hdc, hrgn);
if(!empty)
PSDRV_WriteGRestore(physDev);
DeleteObject(hrgn);
}

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include <stdio.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#if defined(HAVE_FLOAT_H) #if defined(HAVE_FLOAT_H)
@ -34,6 +35,19 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/***********************************************************************
* PSDRV_DrawLine
*/
static void PSDRV_DrawLine( PSDRV_PDEVICE *physDev )
{
if(physDev->pathdepth)
return;
if (physDev->pen.style == PS_NULL)
PSDRV_WriteNewPath(physDev);
else
PSDRV_WriteStroke(physDev);
}
/*********************************************************************** /***********************************************************************
* PSDRV_LineTo * PSDRV_LineTo
@ -50,9 +64,12 @@ BOOL PSDRV_LineTo(PSDRV_PDEVICE *physDev, INT x, INT y)
LPtoDP( physDev->hdc, pt, 2 ); LPtoDP( physDev->hdc, pt, 2 );
PSDRV_SetPen(physDev); PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
PSDRV_WriteMoveTo(physDev, pt[0].x, pt[0].y ); PSDRV_WriteMoveTo(physDev, pt[0].x, pt[0].y );
PSDRV_WriteLineTo(physDev, pt[1].x, pt[1].y ); PSDRV_WriteLineTo(physDev, pt[1].x, pt[1].y );
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -73,11 +90,23 @@ BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
rect.bottom = bottom; rect.bottom = bottom;
LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); LPtoDP( physDev->hdc, (POINT *)&rect, 2 );
/* HACK to get inserted eps files printing from Office 2k */
if(GetROP2(physDev->hdc) == R2_NOP) {
char buf[256];
sprintf(buf, "%ld %ld %ld %ld B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
return TRUE;
}
PSDRV_WriteSpool(physDev, "%Rectangle\n",11);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left, PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top ); rect.bottom - rect.top );
PSDRV_Brush(physDev,0); PSDRV_Brush(physDev,0);
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -112,6 +141,10 @@ BOOL PSDRV_RoundRect( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
if (ell_width > right - left) ell_width = right - left; if (ell_width > right - left) ell_width = right - left;
if (ell_height > bottom - top) ell_height = bottom - top; if (ell_height > bottom - top) ell_height = bottom - top;
PSDRV_WriteSpool(physDev, "%RoundRect\n",11);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
PSDRV_WriteMoveTo( physDev, left, top + ell_height/2 ); PSDRV_WriteMoveTo( physDev, left, top + ell_height/2 );
PSDRV_WriteArc( physDev, left + ell_width/2, top + ell_height/2, ell_width, PSDRV_WriteArc( physDev, left + ell_width/2, top + ell_height/2, ell_width,
ell_height, 90.0, 180.0); ell_height, 90.0, 180.0);
@ -127,8 +160,8 @@ BOOL PSDRV_RoundRect( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
PSDRV_WriteClosePath( physDev ); PSDRV_WriteClosePath( physDev );
PSDRV_Brush(physDev,0); PSDRV_Brush(physDev,0);
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -176,6 +209,10 @@ static BOOL PSDRV_DrawArc( PSDRV_PDEVICE *physDev, INT left, INT top,
start_angle *= 180.0 / PI; start_angle *= 180.0 / PI;
end_angle *= 180.0 / PI; end_angle *= 180.0 / PI;
PSDRV_WriteSpool(physDev,"%DrawArc\n", 9);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
if(lines == 2) /* pie */ if(lines == 2) /* pie */
PSDRV_WriteMoveTo(physDev, x, y); PSDRV_WriteMoveTo(physDev, x, y);
else else
@ -186,8 +223,9 @@ static BOOL PSDRV_DrawArc( PSDRV_PDEVICE *physDev, INT left, INT top,
PSDRV_WriteClosePath(physDev); PSDRV_WriteClosePath(physDev);
PSDRV_Brush(physDev,0); PSDRV_Brush(physDev,0);
} }
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -242,12 +280,16 @@ BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bo
w = rect.right - rect.left; w = rect.right - rect.left;
h = rect.bottom - rect.top; h = rect.bottom - rect.top;
PSDRV_WriteSpool(physDev, "%Ellipse\n", 9);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
PSDRV_WriteNewPath(physDev); PSDRV_WriteNewPath(physDev);
PSDRV_WriteArc(physDev, x, y, w, h, 0.0, 360.0); PSDRV_WriteArc(physDev, x, y, w, h, 0.0, 360.0);
PSDRV_WriteClosePath(physDev); PSDRV_WriteClosePath(physDev);
PSDRV_Brush(physDev,0); PSDRV_Brush(physDev,0);
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -269,6 +311,11 @@ BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD*
LPtoDP( physDev->hdc, dev_pts, total ); LPtoDP( physDev->hdc, dev_pts, total );
pt = dev_pts; pt = dev_pts;
PSDRV_WriteSpool(physDev, "%PolyPolyline\n",14);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
for(polyline = 0; polyline < polylines; polyline++) { for(polyline = 0; polyline < polylines; polyline++) {
PSDRV_WriteMoveTo(physDev, pt->x, pt->y); PSDRV_WriteMoveTo(physDev, pt->x, pt->y);
pt++; pt++;
@ -276,8 +323,9 @@ BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD*
PSDRV_WriteLineTo(physDev, pt->x, pt->y); PSDRV_WriteLineTo(physDev, pt->x, pt->y);
} }
HeapFree( GetProcessHeap(), 0, dev_pts ); HeapFree( GetProcessHeap(), 0, dev_pts );
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -308,6 +356,11 @@ BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* cou
LPtoDP( physDev->hdc, dev_pts, total ); LPtoDP( physDev->hdc, dev_pts, total );
pt = dev_pts; pt = dev_pts;
PSDRV_WriteSpool(physDev, "%PolyPolygon\n",13);
PSDRV_SetPen(physDev);
PSDRV_SetClip(physDev);
for(polygon = 0; polygon < polygons; polygon++) { for(polygon = 0; polygon < polygons; polygon++) {
PSDRV_WriteMoveTo(physDev, pt->x, pt->y); PSDRV_WriteMoveTo(physDev, pt->x, pt->y);
pt++; pt++;
@ -321,8 +374,9 @@ BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* cou
PSDRV_Brush(physDev, 1); PSDRV_Brush(physDev, 1);
else /* WINDING */ else /* WINDING */
PSDRV_Brush(physDev, 0); PSDRV_Brush(physDev, 0);
PSDRV_SetPen(physDev);
PSDRV_DrawLine(physDev); PSDRV_DrawLine(physDev);
PSDRV_ResetClip(physDev);
return TRUE; return TRUE;
} }
@ -348,24 +402,15 @@ COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color )
pt.y = y; pt.y = y;
LPtoDP( physDev->hdc, &pt, 1 ); LPtoDP( physDev->hdc, &pt, 1 );
PSDRV_SetClip(physDev);
/* we bracket the setcolor in gsave/grestore so that we don't trash
the current pen colour */
PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle( physDev, pt.x, pt.y, 0, 0 ); PSDRV_WriteRectangle( physDev, pt.x, pt.y, 0, 0 );
PSDRV_CreateColor( physDev, &pscolor, color ); PSDRV_CreateColor( physDev, &pscolor, color );
PSDRV_WriteSetColor( physDev, &pscolor ); PSDRV_WriteSetColor( physDev, &pscolor );
PSDRV_WriteFill( physDev ); PSDRV_WriteFill( physDev );
PSDRV_WriteGRestore(physDev);
PSDRV_ResetClip(physDev);
return color; return color;
} }
/***********************************************************************
* PSDRV_DrawLine
*/
VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev )
{
if(physDev->pathdepth)
return;
if (physDev->pen.style == PS_NULL)
PSDRV_WriteNewPath(physDev);
else
PSDRV_WriteStroke(physDev);
}

View File

@ -603,7 +603,7 @@ BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number)
BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst, BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthSrc, INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits) INT heightSrc, char *bits, BOOL mask)
{ {
char start[] = "%d %d translate\n%d %d scale\n<<\n" char start[] = "%d %d translate\n%d %d scale\n<<\n"
" /ImageType 1\n /Width %d\n /Height %d\n /BitsPerComponent %d\n" " /ImageType 1\n /Width %d\n /Height %d\n /BitsPerComponent %d\n"
@ -613,6 +613,8 @@ BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst
char decode3[] = " /Decode [0 1 0 1 0 1]\n"; char decode3[] = " /Decode [0 1 0 1 0 1]\n";
char end[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> image\n"; char end[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> image\n";
char endmask[] = " /DataSource currentfile /ASCIIHexDecode filter\n>> imagemask\n";
char endbits[] = " /DataSource <%s>\n>> image\n"; char endbits[] = " /DataSource <%s>\n>> image\n";
char *buf = HeapAlloc(PSDRV_Heap, 0, 1000); char *buf = HeapAlloc(PSDRV_Heap, 0, 1000);
@ -642,9 +644,12 @@ BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst
PSDRV_WriteSpool(physDev, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(!bits) if(!bits) {
PSDRV_WriteSpool(physDev, end, sizeof(end) - 1); if(!mask)
else { PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
else
PSDRV_WriteSpool(physDev, endmask, sizeof(endmask) - 1);
} else {
sprintf(buf, endbits, bits); sprintf(buf, endbits, bits);
PSDRV_WriteSpool(physDev, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
@ -810,7 +815,7 @@ BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits)
ptr += 2; ptr += 2;
} }
} }
PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf); PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf, FALSE);
PSDRV_WriteSpool(physDev, end, sizeof(end) - 1); PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
@ -858,7 +863,7 @@ BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usa
ptr += 2; ptr += 2;
} }
} }
PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf); PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf, FALSE);
PSDRV_WriteSpool(physDev, end, sizeof(end) - 1); PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;

View File

@ -384,6 +384,9 @@ extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev ); extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev ); extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
extern void PSDRV_SetClip(PSDRV_PDEVICE* phyDev);
extern void PSDRV_ResetClip(PSDRV_PDEVICE* phyDev);
extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2); extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2); extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
@ -427,7 +430,7 @@ extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number); extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number);
extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst, extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthSrc, INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits); INT heightSrc, char *bits, BOOL mask);
extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number); extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number);
extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number); extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number); extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
@ -491,8 +494,7 @@ extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
LPCSTR lpszPort, LPCSTR lpszPort,
WORD fwCapability, LPSTR lpszOutput, WORD fwCapability, LPSTR lpszOutput,
LPDEVMODEA lpDevMode); LPDEVMODEA lpdm);
VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev );
INT PSDRV_GlyphListInit(void); INT PSDRV_GlyphListInit(void);
const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName); const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
VOID PSDRV_IndexGlyphList(void); VOID PSDRV_IndexGlyphList(void);

View File

@ -47,6 +47,8 @@ BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
/* write font if not already written */ /* write font if not already written */
PSDRV_SetFont(physDev); PSDRV_SetFont(physDev);
PSDRV_SetClip(physDev);
/* set clipping and/or draw background */ /* set clipping and/or draw background */
if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL)) if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL))
{ {
@ -79,6 +81,7 @@ BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
bResult = PSDRV_Text(physDev, x, y, flags, str, count, TRUE, lpDx); bResult = PSDRV_Text(physDev, x, y, flags, str, count, TRUE, lpDx);
} }
PSDRV_ResetClip(physDev);
return bResult; return bResult;
} }