2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
9 #ifndef X_DISPLAY_MISSING
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->w.hGCClipRgn, REGION_MAGIC);
36 ERR(x11drv, "Rgn is 0. Please report this.\n");
40 if (obj->rgn->numRects > 0)
43 RECT32 *pRect = obj->rgn->rects;
44 RECT32 *pEndRect = obj->rgn->rects + obj->rgn->numRects;
46 pXrect = HeapAlloc( GetProcessHeap(), 0,
47 sizeof(*pXrect) * obj->rgn->numRects );
50 WARN(x11drv, "Can't alloc buffer\n");
54 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
58 pXr->width = pRect->right - pRect->left;
59 pXr->height = pRect->bottom - pRect->top;
65 TSXSetClipRectangles( display, physDev->gc, 0, 0,
66 pXrect, obj->rgn->numRects, YXBanded );
69 HeapFree( GetProcessHeap(), 0, pXrect );
71 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
74 #endif /* !defined(X_DISPLAY_MISSING) */