2 * PostScript clipping functions
4 * Copyright 1999 Luc Tourangau
10 #include "debugtools.h"
13 DEFAULT_DEBUG_CHANNEL(psdrv)
15 /***********************************************************************
16 * PSDRV_SetDeviceClipping
18 VOID PSDRV_SetDeviceClipping( DC *dc )
20 CHAR szArrayName[] = "clippath";
24 TRACE("hdc=%04x\n", dc->hSelf);
26 if (dc->w.hGCClipRgn == 0) {
27 ERR("Rgn is 0. Please report this.\n");
31 size = GetRegionData(dc->w.hGCClipRgn, 0, NULL);
33 ERR("Invalid region\n");
37 rgndata = HeapAlloc( GetProcessHeap(), 0, size );
39 ERR("Can't allocate buffer\n");
43 GetRegionData(dc->w.hGCClipRgn, size, rgndata);
45 if (rgndata->rdh.nCount > 0)
48 RECT *pRect = (RECT *)rgndata->Buffer;
50 PSDRV_WriteArrayDef(dc, szArrayName, rgndata->rdh.nCount * 4);
52 for (i = 0; i < rgndata->rdh.nCount; i++, pRect++)
54 PSDRV_WriteArrayPut(dc, szArrayName, i * 4,
56 PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 1,
58 PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 2,
59 pRect->right - pRect->left);
60 PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3,
61 pRect->bottom - pRect->top);
65 PSDRV_WriteRectClip(dc, szArrayName);
66 HeapFree( GetProcessHeap(), 0, rgndata );