Fixed the prototype of CreateDIBPatternBrushPt
[wine/multimedia.git] / graphics / x11drv / clipping.c
blob8af6eaf5abadbe0d475da3adb34c58b9b004cfa8
1 /*
2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
5 */
7 #include <stdio.h>
8 #include "dc.h"
9 #include "x11drv.h"
10 #include "region.h"
11 #include "debug.h"
12 #include "heap.h"
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 )
23 XRectangle *pXrect;
24 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
26 RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
27 if (!obj)
29 ERR(x11drv, "Rgn is 0. Please report this.\n");
30 return;
33 if (obj->rgn->numRects > 0)
35 XRectangle *pXr;
36 RECT32 *pRect = obj->rgn->rects;
37 RECT32 *pEndRect = obj->rgn->rects + obj->rgn->numRects;
39 pXrect = HeapAlloc( GetProcessHeap(), 0,
40 sizeof(*pXrect) * obj->rgn->numRects );
41 if(!pXrect)
43 WARN(x11drv, "Can't alloc buffer\n");
44 return;
47 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
49 pXr->x = pRect->left;
50 pXr->y = pRect->top;
51 pXr->width = pRect->right - pRect->left;
52 pXr->height = pRect->bottom - pRect->top;
55 else
56 pXrect = NULL;
58 TSXSetClipRectangles( display, physDev->gc, 0, 0,
59 pXrect, obj->rgn->numRects, YXBanded );
61 if(pXrect)
62 HeapFree( GetProcessHeap(), 0, pXrect );
64 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );