2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
14 /***********************************************************************
15 * X11DRV_SetDeviceClipping
16 * Copy RECT32s to a temporary buffer of XRectangles and call
17 * TSXSetClipRectangles().
19 * Could write using GetRegionData but this would be slower.
21 void X11DRV_SetDeviceClipping( DC
* dc
)
24 RGNOBJ
*obj
= (RGNOBJ
*) GDI_GetObjPtr(dc
->w
.hGCClipRgn
, REGION_MAGIC
);
27 ERR(x11drv
, "Rgn is 0. Please report this.\n");
31 if (obj
->rgn
->numRects
> 0)
34 RECT32
*pRect
= obj
->rgn
->rects
;
35 RECT32
*pEndRect
= obj
->rgn
->rects
+ obj
->rgn
->numRects
;
37 pXrect
= HeapAlloc( GetProcessHeap(), 0,
38 sizeof(*pXrect
) * obj
->rgn
->numRects
);
41 WARN(x11drv
, "Can't alloc buffer\n");
45 for(pXr
= pXrect
; pRect
< pEndRect
; pRect
++, pXr
++)
49 pXr
->width
= pRect
->right
- pRect
->left
;
50 pXr
->height
= pRect
->bottom
- pRect
->top
;
56 TSXSetClipRectangles( display
, dc
->u
.x
.gc
, dc
->w
.DCOrgX
, dc
->w
.DCOrgY
,
57 pXrect
, obj
->rgn
->numRects
, YXBanded
);
60 HeapFree( GetProcessHeap(), 0, pXrect
);
62 GDI_HEAP_UNLOCK( dc
->w
.hGCClipRgn
);