Removed some direct accesses to GDI internal pen/brush/font
[wine] / graphics / win16drv / brush.c
1 /*
2  * GDI brush objects - win16drv
3  *
4  * Copyright 1997  John Harvey
5  */
6
7 #include <stdlib.h>
8 #include "win16drv.h"
9 #include "heap.h"
10 #include "debugtools.h"
11
12 DEFAULT_DEBUG_CHANNEL(win16drv);
13
14 HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
15 {
16     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
17     HBRUSH16     prevHandle = dc->hBrush;
18     int          nSize;
19     LOGBRUSH16 lBrush16;
20
21     if (!GetObject16( hbrush, sizeof(lBrush16), &lBrush16 )) return 0;
22
23     dc->hBrush = hbrush;
24     if ( physDev->BrushInfo )
25     {
26         TRACE("UnRealizing BrushInfo\n");
27         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
28                                       physDev->BrushInfo,
29                                       physDev->BrushInfo, 0);
30     }
31     else 
32     {
33         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH,
34                                   &lBrush16, 0, 0); 
35         physDev->BrushInfo = SEGPTR_ALLOC( nSize );
36     }
37
38
39     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
40                                  &lBrush16, 
41                                  physDev->BrushInfo, 
42                                  win16drv_SegPtr_TextXForm); 
43                          
44     return prevHandle;
45 }