- New implementation of SendMessage, ReceiveMessage, ReplyMessage functions
[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 "brush.h"
9 #include "win16drv.h"
10 #include "heap.h"
11 #include "debug.h"
12
13 HBRUSH32 WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
14                                       BRUSHOBJ * brush )
15 {
16     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
17     HBRUSH16     prevHandle = dc->w.hBrush;
18     int          nSize;
19     LOGBRUSH16   lBrush16;
20     dc->w.hBrush = hbrush;
21     lBrush16.lbStyle = brush->logbrush.lbStyle;
22     lBrush16.lbColor = brush->logbrush.lbColor;
23     lBrush16.lbHatch = brush->logbrush.lbHatch;
24
25
26     if ( physDev->BrushInfo )
27     {
28         TRACE(win16drv, "UnRealizing BrushInfo\n");
29         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
30                                       physDev->BrushInfo,
31                                       physDev->BrushInfo, 0);
32     }
33     else 
34     {
35         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH,
36                                   &lBrush16, 0, 0); 
37         physDev->BrushInfo = SEGPTR_ALLOC( nSize );
38     }
39
40
41     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
42                                  &lBrush16, 
43                                  physDev->BrushInfo, 
44                                  win16drv_SegPtr_TextXForm); 
45                          
46     return prevHandle;
47 }