Commit 62efee23 authored by Stephane Lussier's avatar Stephane Lussier Committed by Alexandre Julliard

Fixed the clipping for the postscript driver and turned it on (by setting

PSDRV_SetDeviceClipping in the function table).
parent c25e7153
...@@ -42,7 +42,24 @@ VOID PSDRV_SetDeviceClipping( DC *dc ) ...@@ -42,7 +42,24 @@ VOID PSDRV_SetDeviceClipping( DC *dc )
GetRegionData(dc->w.hGCClipRgn, size, rgndata); GetRegionData(dc->w.hGCClipRgn, size, rgndata);
if (rgndata->rdh.nCount > 0) PSDRV_WriteInitClip(dc);
/* check for NULL region */
if (rgndata->rdh.nCount == 0)
{
/* set an empty clip path. */
PSDRV_WriteRectClip(dc, 0, 0, 0, 0);
}
/* optimize when it is a simple region */
else if (rgndata->rdh.nCount == 1)
{
RECT *pRect = (RECT *)rgndata->Buffer;
PSDRV_WriteRectClip(dc, pRect->left, pRect->top,
pRect->right - pRect->left,
pRect->bottom - pRect->top);
}
else
{ {
INT i; INT i;
RECT *pRect = (RECT *)rgndata->Buffer; RECT *pRect = (RECT *)rgndata->Buffer;
...@@ -60,9 +77,10 @@ VOID PSDRV_SetDeviceClipping( DC *dc ) ...@@ -60,9 +77,10 @@ VOID PSDRV_SetDeviceClipping( DC *dc )
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3, PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3,
pRect->bottom - pRect->top); pRect->bottom - pRect->top);
} }
PSDRV_WriteRectClip2(dc, szArrayName);
} }
PSDRV_WriteRectClip(dc, szArrayName);
HeapFree( GetProcessHeap(), 0, rgndata ); HeapFree( GetProcessHeap(), 0, rgndata );
return; return;
} }
...@@ -78,7 +78,7 @@ static const DC_FUNCTIONS PSDRV_Funcs = ...@@ -78,7 +78,7 @@ static const DC_FUNCTIONS PSDRV_Funcs =
NULL, /* pSelectPalette */ NULL, /* pSelectPalette */
PSDRV_SetBkColor, /* pSetBkColor */ PSDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetDeviceClipping */ PSDRV_SetDeviceClipping, /* pSetDeviceClipping */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */
NULL, /* pSetMapMode (optional) */ NULL, /* pSetMapMode (optional) */
NULL, /* pSetMapperFlags */ NULL, /* pSetMapperFlags */
......
...@@ -161,10 +161,16 @@ static char psclosepath[] = ...@@ -161,10 +161,16 @@ static char psclosepath[] =
static char psclip[] = static char psclip[] =
"clip\n"; "clip\n";
static char psinitclip[] =
"initclip\n";
static char pseoclip[] = static char pseoclip[] =
"eoclip\n"; "eoclip\n";
static char psrectclip[] = static char psrectclip[] =
"%d %d %d %d rectclip\n";
static char psrectclip2[] =
"%s rectclip\n"; "%s rectclip\n";
static char pshatch[] = static char pshatch[] =
...@@ -702,6 +708,11 @@ BOOL PSDRV_WriteEOClip(DC *dc) ...@@ -702,6 +708,11 @@ BOOL PSDRV_WriteEOClip(DC *dc)
return PSDRV_WriteSpool(dc, pseoclip, sizeof(pseoclip)-1); return PSDRV_WriteSpool(dc, pseoclip, sizeof(pseoclip)-1);
} }
BOOL PSDRV_WriteInitClip(DC *dc)
{
return PSDRV_WriteSpool(dc, psinitclip, sizeof(psinitclip)-1);
}
BOOL PSDRV_WriteHatch(DC *dc) BOOL PSDRV_WriteHatch(DC *dc)
{ {
return PSDRV_WriteSpool(dc, pshatch, sizeof(pshatch)-1); return PSDRV_WriteSpool(dc, pshatch, sizeof(pshatch)-1);
...@@ -911,14 +922,21 @@ BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize) ...@@ -911,14 +922,21 @@ BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize)
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(dc, buf, strlen(buf));
} }
BOOL PSDRV_WriteRectClip(DC *dc, CHAR *pszArrayName) BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h)
{ {
char buf[100]; char buf[100];
sprintf(buf, psrectclip, pszArrayName); sprintf(buf, psrectclip, x, y, w, h);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(dc, buf, strlen(buf));
} }
BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName)
{
char buf[100];
sprintf(buf, psrectclip2, pszArrayName);
return PSDRV_WriteSpool(dc, buf, strlen(buf));
}
BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits) BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits)
{ {
......
...@@ -289,8 +289,10 @@ extern BOOL PSDRV_WriteGSave(DC *dc); ...@@ -289,8 +289,10 @@ extern BOOL PSDRV_WriteGSave(DC *dc);
extern BOOL PSDRV_WriteGRestore(DC *dc); extern BOOL PSDRV_WriteGRestore(DC *dc);
extern BOOL PSDRV_WriteNewPath(DC *dc); extern BOOL PSDRV_WriteNewPath(DC *dc);
extern BOOL PSDRV_WriteClosePath(DC *dc); extern BOOL PSDRV_WriteClosePath(DC *dc);
extern BOOL PSDRV_WriteInitClip(DC *dc);
extern BOOL PSDRV_WriteClip(DC *dc); extern BOOL PSDRV_WriteClip(DC *dc);
extern BOOL PSDRV_WriteRectClip(DC *dc, CHAR *pszArrayName); extern BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h);
extern BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName);
extern BOOL PSDRV_WriteEOClip(DC *dc); extern BOOL PSDRV_WriteEOClip(DC *dc);
extern BOOL PSDRV_WriteHatch(DC *dc); extern BOOL PSDRV_WriteHatch(DC *dc);
extern BOOL PSDRV_WriteRotate(DC *dc, float ang); extern BOOL PSDRV_WriteRotate(DC *dc, float ang);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment