2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
9 #ifndef X_DISPLAY_MISSING
17 #include "debugtools.h"
21 DEFAULT_DEBUG_CHANNEL(x11drv)
23 /***********************************************************************
24 * X11DRV_SetDeviceClipping
25 * Copy RECT32s to a temporary buffer of XRectangles and call
26 * TSXSetClipRectangles().
28 * Could write using GetRegionData but this would be slower.
30 void X11DRV_SetDeviceClipping( DC * dc )
33 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
35 RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
38 ERR("Rgn is 0. Please report this.\n");
42 if (obj->rgn->numRects > 0)
45 RECT *pRect = obj->rgn->rects;
46 RECT *pEndRect = obj->rgn->rects + obj->rgn->numRects;
48 pXrect = HeapAlloc( GetProcessHeap(), 0,
49 sizeof(*pXrect) * obj->rgn->numRects );
52 WARN("Can't alloc buffer\n");
53 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
57 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
61 pXr->width = pRect->right - pRect->left;
62 pXr->height = pRect->bottom - pRect->top;
68 TSXSetClipRectangles( display, physDev->gc, 0, 0,
69 pXrect, obj->rgn->numRects, YXBanded );
72 HeapFree( GetProcessHeap(), 0, pXrect );
74 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
77 #endif /* !defined(X_DISPLAY_MISSING) */