Fixed allocation of 16x16 icons.
[wine.git] / graphics / win16drv / pen.c
blobd6ad8b064e7f8b22583ef55346104726a11bd461
1 /*
2 * GDI pen objects
4 * Copyright 1997 John Harvey
5 */
7 #include "pen.h"
8 #include "win16drv.h"
9 #include "heap.h"
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(win16drv)
14 /***********************************************************************
15 * PEN_SelectObject
17 HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
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("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;
30 if ( physDev->PenInfo )
32 TRACE("UnRealizing PenInfo\n");
33 nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
34 physDev->PenInfo,
35 physDev->PenInfo, 0);
37 else
39 nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
40 &lPen16, 0, 0);
41 physDev->PenInfo = SEGPTR_ALLOC( nSize );
44 nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
45 &lPen16,
46 physDev->PenInfo,
47 0);
49 return prevHandle;