2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
16 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(x11drv)
22 /***********************************************************************
23 * X11DRV_SetDeviceClipping
24 * Copy RECT32s to a temporary buffer of XRectangles and call
25 * TSXSetClipRectangles().
27 * Could write using GetRegionData but this would be slower.
29 void X11DRV_SetDeviceClipping( DC * dc )
32 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
34 RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
37 ERR("Rgn is 0. Please report this.\n");
41 if (obj->rgn->numRects > 0)
44 RECT *pRect = obj->rgn->rects;
45 RECT *pEndRect = obj->rgn->rects + obj->rgn->numRects;
47 pXrect = HeapAlloc( GetProcessHeap(), 0,
48 sizeof(*pXrect) * obj->rgn->numRects );
51 WARN("Can't alloc buffer\n");
52 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
56 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
60 pXr->width = pRect->right - pRect->left;
61 pXr->height = pRect->bottom - pRect->top;
67 TSXSetClipRectangles( display, physDev->gc, 0, 0,
68 pXrect, obj->rgn->numRects, YXBanded );
71 HeapFree( GetProcessHeap(), 0, pXrect );
73 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );