2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
16 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(x11drv);
21 /***********************************************************************
22 * X11DRV_SetDeviceClipping
23 * Copy RECT32s to a temporary buffer of XRectangles and call
24 * TSXSetClipRectangles().
26 * Could write using GetRegionData but this would be slower.
28 void X11DRV_SetDeviceClipping( DC * dc )
31 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
33 RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->hGCClipRgn, REGION_MAGIC);
36 ERR("Rgn is 0. Please report this.\n");
40 if (obj->rgn->numRects > 0)
43 RECT *pRect = obj->rgn->rects;
44 RECT *pEndRect = obj->rgn->rects + obj->rgn->numRects;
46 pXrect = HeapAlloc( GetProcessHeap(), 0,
47 sizeof(*pXrect) * obj->rgn->numRects );
50 WARN("Can't alloc buffer\n");
51 GDI_ReleaseObj( dc->hGCClipRgn );
55 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
59 pXr->width = pRect->right - pRect->left;
60 pXr->height = pRect->bottom - pRect->top;
66 TSXSetClipRectangles( display, physDev->gc, 0, 0,
67 pXrect, obj->rgn->numRects, YXBanded );
70 HeapFree( GetProcessHeap(), 0, pXrect );
72 GDI_ReleaseObj( dc->hGCClipRgn );