4 * Copyright 1999 Patrik Stridvall
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(ttydrv
);
18 /**********************************************************************/
20 BITMAP_DRIVER TTYDRV_BITMAP_Driver
=
22 TTYDRV_BITMAP_SetDIBits
,
23 TTYDRV_BITMAP_GetDIBits
,
24 TTYDRV_BITMAP_DeleteDIBSection
,
25 TTYDRV_BITMAP_SetDIBColorTable
,
26 TTYDRV_BITMAP_GetDIBColorTable
,
31 PALETTE_DRIVER TTYDRV_PALETTE_Driver
=
33 TTYDRV_PALETTE_SetMapping
,
34 TTYDRV_PALETTE_UpdateMapping
,
38 const DC_FUNCTIONS
*TTYDRV_DC_Funcs
= NULL
; /* hack */
40 /**********************************************************************
41 * TTYDRV_GDI_Initialize
43 BOOL
TTYDRV_GDI_Initialize(void)
45 BITMAP_Driver
= &TTYDRV_BITMAP_Driver
;
46 PALETTE_Driver
= &TTYDRV_PALETTE_Driver
;
48 return TTYDRV_PALETTE_Initialize();
51 /***********************************************************************
54 BOOL
TTYDRV_DC_CreateDC(DC
*dc
, LPCSTR driver
, LPCSTR device
,
55 LPCSTR output
, const DEVMODEA
*initData
)
57 TTYDRV_PDEVICE
*physDev
;
60 TRACE("(%p, %s, %s, %s, %p)\n",
61 dc
, debugstr_a(driver
), debugstr_a(device
),
62 debugstr_a(output
), initData
);
64 if (!TTYDRV_DC_Funcs
) TTYDRV_DC_Funcs
= dc
->funcs
; /* hack */
66 dc
->physDev
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
67 sizeof(TTYDRV_PDEVICE
));
69 ERR("Can't allocate physDev\n");
72 physDev
= (TTYDRV_PDEVICE
*) dc
->physDev
;
74 if(dc
->flags
& DC_MEMORY
){
75 physDev
->window
= NULL
;
76 physDev
->cellWidth
= 1;
77 physDev
->cellHeight
= 1;
79 TTYDRV_DC_CreateBitmap(dc
->hBitmap
);
80 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr(dc
->hBitmap
, BITMAP_MAGIC
);
82 dc
->bitsPerPixel
= bmp
->bitmap
.bmBitsPixel
;
84 dc
->totalExtent
.left
= 0;
85 dc
->totalExtent
.top
= 0;
86 dc
->totalExtent
.right
= bmp
->bitmap
.bmWidth
;
87 dc
->totalExtent
.bottom
= bmp
->bitmap
.bmHeight
;
88 dc
->hVisRgn
= CreateRectRgnIndirect( &dc
->totalExtent
);
90 GDI_ReleaseObj( dc
->hBitmap
);
92 physDev
->window
= root_window
;
93 physDev
->cellWidth
= cell_width
;
94 physDev
->cellHeight
= cell_height
;
97 dc
->totalExtent
.left
= 0;
98 dc
->totalExtent
.top
= 0;
99 dc
->totalExtent
.right
= cell_width
* screen_cols
;
100 dc
->totalExtent
.bottom
= cell_height
* screen_rows
;
101 dc
->hVisRgn
= CreateRectRgnIndirect( &dc
->totalExtent
);
107 /***********************************************************************
110 BOOL
TTYDRV_DC_DeleteDC(DC
*dc
)
114 HeapFree( GetProcessHeap(), 0, dc
->physDev
);
121 /***********************************************************************
122 * GetDeviceCaps (TTYDRV.@)
124 INT
TTYDRV_GetDeviceCaps( DC
*dc
, INT cap
)
131 return DT_RASDISPLAY
;
133 return 0; /* FIXME: Screen width in mm */
135 return 0; /* FIXME: Screen height in mm */
137 return 640; /* FIXME: Screen width in pixel */
139 return 480; /* FIXME: Screen height in pixel */
141 return 1; /* FIXME */
155 return sizeof(TTYDRV_PDEVICE
);
157 return (CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
| CC_WIDE
|
158 CC_STYLED
| CC_WIDESTYLED
| CC_INTERIORS
| CC_ROUNDRECT
);
160 return (LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
161 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
);
163 return (PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
164 PC_SCANLINE
| PC_WIDE
| PC_STYLED
| PC_WIDESTYLED
| PC_INTERIORS
);
170 return (RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
| RC_DI_BITMAP
|
171 RC_DIBTODEV
| RC_BIGFONT
| RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
);
179 return 72; /* FIXME */
181 return 256; /* FIXME */
188 case PHYSICALOFFSETX
:
189 case PHYSICALOFFSETY
:
198 FIXME("(%04x): unsupported capability %d, will return 0\n", dc
->hSelf
, cap
);
204 /***********************************************************************
205 * TTYDRV_DC_SetDeviceClipping
207 void TTYDRV_DC_SetDeviceClipping(DC
*dc
)