Set and retrieve the window icon that is drawn under managed mode
[wine/wine-kai.git] / graphics / x11drv / clipping.c
blob5905217116dc9faa70975a8811e143c9780e2b6a
1 /*
2 * X11DRV clipping functions
4 * Copyright 1998 Huw Davies
5 */
7 #include "config.h"
9 #include "ts_xlib.h"
11 #include <stdio.h>
13 #include "dc.h"
14 #include "x11drv.h"
15 #include "region.h"
16 #include "debugtools.h"
17 #include "heap.h"
18 #include "local.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 )
31 XRectangle *pXrect;
32 X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
34 RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
35 if (!obj)
37 ERR("Rgn is 0. Please report this.\n");
38 return;
41 if (obj->rgn->numRects > 0)
43 XRectangle *pXr;
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 );
49 if(!pXrect)
51 WARN("Can't alloc buffer\n");
52 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );
53 return;
56 for(pXr = pXrect; pRect < pEndRect; pRect++, pXr++)
58 pXr->x = pRect->left;
59 pXr->y = pRect->top;
60 pXr->width = pRect->right - pRect->left;
61 pXr->height = pRect->bottom - pRect->top;
64 else
65 pXrect = NULL;
67 TSXSetClipRectangles( display, physDev->gc, 0, 0,
68 pXrect, obj->rgn->numRects, YXBanded );
70 if(pXrect)
71 HeapFree( GetProcessHeap(), 0, pXrect );
73 GDI_HEAP_UNLOCK( dc->w.hGCClipRgn );