New debug scheme with explicit debug channels declaration.
[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 DEFAULT_DEBUG_CHANNEL(win16drv)
13
14 /***********************************************************************
15  *           PEN_SelectObject
16  */
17 HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
18 {
19     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
20     HPEN prevHandle = dc->w.hPen;
21     int          nSize;
22     LOGPEN16     lPen16;
23     dc->w.hPen = hpen;
24     TRACE(win16drv, "In WIN16DRV_PEN_SelectObject\n");
25     lPen16.lopnStyle   = pen->logpen.lopnStyle;
26     lPen16.lopnWidth.x = pen->logpen.lopnWidth.x;
27     lPen16.lopnWidth.y = pen->logpen.lopnWidth.y;
28     lPen16.lopnColor   = pen->logpen.lopnColor;
29
30     if ( physDev->PenInfo )
31     {
32         TRACE(win16drv, "UnRealizing PenInfo\n");
33         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
34                                       physDev->PenInfo,
35                                       physDev->PenInfo, 0);
36     }
37     else 
38     {
39         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
40                                   &lPen16, 0, 0); 
41         physDev->PenInfo = SEGPTR_ALLOC( nSize );
42     }
43
44     nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
45                                  &lPen16, 
46                                  physDev->PenInfo, 
47                                  0); 
48
49     return prevHandle;
50 }
51