1999-07-18 20:34:45 +02:00
|
|
|
/*
|
|
|
|
* PostScript clipping functions
|
|
|
|
*
|
|
|
|
* Copyright 1999 Luc Tourangau
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gdi.h"
|
|
|
|
#include "psdrv.h"
|
|
|
|
#include "debugtools.h"
|
1999-07-25 13:14:47 +02:00
|
|
|
#include "winbase.h"
|
1999-07-18 20:34:45 +02:00
|
|
|
|
|
|
|
DEFAULT_DEBUG_CHANNEL(psdrv)
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* PSDRV_SetDeviceClipping
|
|
|
|
*/
|
|
|
|
VOID PSDRV_SetDeviceClipping( DC *dc )
|
|
|
|
{
|
|
|
|
CHAR szArrayName[] = "clippath";
|
1999-07-25 13:14:47 +02:00
|
|
|
DWORD size;
|
|
|
|
RGNDATA *rgndata;
|
|
|
|
|
|
|
|
TRACE("hdc=%04x\n", dc->hSelf);
|
|
|
|
|
|
|
|
if (dc->w.hGCClipRgn == 0) {
|
|
|
|
ERR("Rgn is 0. Please report this.\n");
|
1999-07-18 20:34:45 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-25 13:14:47 +02:00
|
|
|
size = GetRegionData(dc->w.hGCClipRgn, 0, NULL);
|
|
|
|
if(!size) {
|
|
|
|
ERR("Invalid region\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rgndata = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
if(!rgndata) {
|
|
|
|
ERR("Can't allocate buffer\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetRegionData(dc->w.hGCClipRgn, size, rgndata);
|
|
|
|
|
|
|
|
if (rgndata->rdh.nCount > 0)
|
1999-07-18 20:34:45 +02:00
|
|
|
{
|
|
|
|
INT i;
|
1999-07-25 13:14:47 +02:00
|
|
|
RECT *pRect = (RECT *)rgndata->Buffer;
|
1999-07-18 20:34:45 +02:00
|
|
|
|
1999-07-25 13:14:47 +02:00
|
|
|
PSDRV_WriteArrayDef(dc, szArrayName, rgndata->rdh.nCount * 4);
|
1999-07-18 20:34:45 +02:00
|
|
|
|
1999-07-25 13:14:47 +02:00
|
|
|
for (i = 0; i < rgndata->rdh.nCount; i++, pRect++)
|
1999-07-18 20:34:45 +02:00
|
|
|
{
|
|
|
|
PSDRV_WriteArrayPut(dc, szArrayName, i * 4,
|
|
|
|
pRect->left);
|
|
|
|
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 1,
|
|
|
|
pRect->top);
|
|
|
|
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 2,
|
|
|
|
pRect->right - pRect->left);
|
|
|
|
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3,
|
|
|
|
pRect->bottom - pRect->top);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PSDRV_WriteRectClip(dc, szArrayName);
|
1999-07-25 13:14:47 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, rgndata );
|
|
|
|
return;
|
1999-07-18 20:34:45 +02:00
|
|
|
}
|