Large-scale renaming of all Win32 functions and types to use the
[wine] / graphics / win16drv / pen.c
1 /*
2  * GDI pen objects
3  *
4  * Copyright 1997 John Harvey
5  */
6
7 #include "pen.h"
8 #include "win16drv.h"
9 #include "heap.h"
10 #include "debug.h"
11
12 /***********************************************************************
13  *           PEN_SelectObject
14  */
15 HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
16 {
17     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
18     HPEN prevHandle = dc->w.hPen;
19     int          nSize;
20     LOGPEN16     lPen16;
21     dc->w.hPen = hpen;
22     TRACE(win16drv, "In WIN16DRV_PEN_SelectObject\n");
23     lPen16.lopnStyle   = pen->logpen.lopnStyle;
24     lPen16.lopnWidth.x = pen->logpen.lopnWidth.x;
25     lPen16.lopnWidth.y = pen->logpen.lopnWidth.y;
26     lPen16.lopnColor   = pen->logpen.lopnColor;
27
28     if ( physDev->PenInfo )
29     {
30         TRACE(win16drv, "UnRealizing PenInfo\n");
31         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
32                                       physDev->PenInfo,
33                                       physDev->PenInfo, 0);
34     }
35     else 
36     {
37         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
38                                   &lPen16, 0, 0); 
39         physDev->PenInfo = SEGPTR_ALLOC( nSize );
40     }
41
42     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
43                                  &lPen16, 
44                                  physDev->PenInfo, 
45                                  0); 
46
47     return prevHandle;
48 }
49