1999-02-04 11:10:59 +01:00
|
|
|
/*
|
2000-08-10 03:16:19 +02:00
|
|
|
* TTY DC driver
|
1999-02-04 11:10:59 +01:00
|
|
|
*
|
2000-08-10 03:16:19 +02:00
|
|
|
* Copyright 1999 Patrik Stridvall
|
1999-02-04 11:10:59 +01:00
|
|
|
*/
|
|
|
|
|
1999-11-24 00:43:29 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
#include "gdi.h"
|
|
|
|
#include "bitmap.h"
|
2000-08-10 03:16:19 +02:00
|
|
|
#include "palette.h"
|
1999-02-04 11:10:59 +01:00
|
|
|
#include "ttydrv.h"
|
2000-08-10 03:16:19 +02:00
|
|
|
#include "winbase.h"
|
1999-11-24 00:43:29 +01:00
|
|
|
#include "debugtools.h"
|
1999-02-04 11:10:59 +01:00
|
|
|
|
2000-08-10 03:16:19 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(ttydrv);
|
|
|
|
|
|
|
|
/**********************************************************************/
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
static const DC_FUNCTIONS TTYDRV_DC_Driver =
|
1999-02-04 11:10:59 +01:00
|
|
|
{
|
1999-05-17 18:20:51 +02:00
|
|
|
NULL, /* pAbortDoc */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pAbortPath */
|
|
|
|
NULL, /* pAngleArc */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_Arc, /* pArc */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pArcTo */
|
|
|
|
NULL, /* pBeginPath */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_BitBlt, /* pBitBlt */
|
1999-12-12 00:08:48 +01:00
|
|
|
TTYDRV_DC_BitmapBits,/* pBitmapBits */
|
2000-05-12 22:18:14 +02:00
|
|
|
NULL, /* pChoosePixelFormat */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_Chord, /* pChord */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pCloseFigure */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_CreateBitmap, /* pCreateBitmap */
|
1999-04-01 10:16:08 +02:00
|
|
|
TTYDRV_DC_CreateDC, /* pCreateDC */
|
|
|
|
NULL, /* pCreateDIBSection */
|
|
|
|
NULL, /* pCreateDIBSection16 */
|
1999-05-17 18:20:51 +02:00
|
|
|
TTYDRV_DC_DeleteDC, /* pDeleteDC */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_DeleteObject, /* pDeleteObject */
|
2000-05-12 22:18:14 +02:00
|
|
|
NULL, /* pDescribePixelFormat */
|
1999-05-17 18:20:51 +02:00
|
|
|
NULL, /* pDeviceCapabilities */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_Ellipse, /* pEllipse */
|
1999-05-17 18:20:51 +02:00
|
|
|
NULL, /* pEndDoc */
|
|
|
|
NULL, /* pEndPage */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pEndPath */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pEnumDeviceFonts */
|
1999-04-01 10:16:08 +02:00
|
|
|
TTYDRV_DC_Escape, /* pEscape */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pExcludeClipRect */
|
1999-05-17 18:20:51 +02:00
|
|
|
NULL, /* pExtDeviceMode */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_ExtFloodFill, /* pExtFloodFill */
|
|
|
|
TTYDRV_DC_ExtTextOut, /* pExtTextOut */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pFillPath */
|
1999-11-24 00:43:29 +01:00
|
|
|
NULL, /* pFillRgn */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pFlattenPath */
|
1999-11-24 00:43:29 +01:00
|
|
|
NULL, /* pFrameRgn */
|
|
|
|
TTYDRV_DC_GetCharWidth, /* pGetCharWidth */
|
2000-03-19 22:19:21 +01:00
|
|
|
NULL, /* pGetDCOrgEx */
|
2001-03-20 02:55:18 +01:00
|
|
|
NULL, /* pGetDeviceGammaRamp */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_GetPixel, /* pGetPixel */
|
2000-05-12 22:18:14 +02:00
|
|
|
NULL, /* pGetPixelFormat */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_GetTextExtentPoint, /* pGetTextExtentPoint */
|
|
|
|
TTYDRV_DC_GetTextMetrics, /* pGetTextMetrics */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pIntersectClipRect */
|
|
|
|
NULL, /* pIntersectVisRect */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_LineTo, /* pLineTo */
|
2000-11-05 04:28:18 +01:00
|
|
|
NULL, /* pMoveTo */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pOffsetClipRgn */
|
|
|
|
NULL, /* pOffsetViewportOrg (optional) */
|
|
|
|
NULL, /* pOffsetWindowOrg (optional) */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_PaintRgn, /* pPaintRgn */
|
|
|
|
TTYDRV_DC_PatBlt, /* pPatBlt */
|
|
|
|
TTYDRV_DC_Pie, /* pPie */
|
1999-12-20 05:14:48 +01:00
|
|
|
NULL, /* pPolyBezier */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pPolyBezierTo */
|
|
|
|
NULL, /* pPolyDraw */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_PolyPolygon, /* pPolyPolygon */
|
|
|
|
TTYDRV_DC_PolyPolyline, /* pPolyPolyline */
|
|
|
|
TTYDRV_DC_Polygon, /* pPolygon */
|
|
|
|
TTYDRV_DC_Polyline, /* pPolyline */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pPolylineTo */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pRealizePalette */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_Rectangle, /* pRectangle */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pRestoreDC */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_RoundRect, /* pRoundRect */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSaveDC */
|
|
|
|
NULL, /* pScaleViewportExt (optional) */
|
|
|
|
NULL, /* pScaleWindowExt (optional) */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pSelectClipPath */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSelectClipRgn */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_SelectObject, /* pSelectObject */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSelectPalette */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_SetBkColor, /* pSetBkColor */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSetBkMode */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_SetDeviceClipping, /* pSetDeviceClipping */
|
2001-03-20 02:55:18 +01:00
|
|
|
NULL, /* pSetDeviceGammaRamp */
|
1999-12-12 00:08:48 +01:00
|
|
|
TTYDRV_DC_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSetMapMode (optional) */
|
|
|
|
NULL, /* pSetMapperFlags */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_SetPixel, /* pSetPixel */
|
2000-05-12 22:18:14 +02:00
|
|
|
NULL, /* pSetPixelFormat */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSetPolyFillMode */
|
|
|
|
NULL, /* pSetROP2 */
|
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_SetTextColor, /* pSetTextColor */
|
1999-02-04 11:10:59 +01:00
|
|
|
NULL, /* pSetTextJustification */
|
|
|
|
NULL, /* pSetViewportExt (optional) */
|
|
|
|
NULL, /* pSetViewportOrg (optional) */
|
|
|
|
NULL, /* pSetWindowExt (optional) */
|
|
|
|
NULL, /* pSetWindowOrg (optional) */
|
1999-05-17 18:20:51 +02:00
|
|
|
NULL, /* pStartDoc */
|
|
|
|
NULL, /* pStartPage */
|
1999-11-24 00:43:29 +01:00
|
|
|
TTYDRV_DC_StretchBlt, /* pStretchBlt */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL, /* pStretchDIBits */
|
|
|
|
NULL, /* pStrokeAndFillPath */
|
|
|
|
NULL, /* pStrokePath */
|
2000-05-12 22:18:14 +02:00
|
|
|
NULL, /* pSwapBuffers */
|
1999-12-06 00:54:02 +01:00
|
|
|
NULL /* pWidenPath */
|
1999-02-04 11:10:59 +01:00
|
|
|
};
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
|
|
|
|
BITMAP_DRIVER TTYDRV_BITMAP_Driver =
|
|
|
|
{
|
|
|
|
TTYDRV_BITMAP_SetDIBits,
|
|
|
|
TTYDRV_BITMAP_GetDIBits,
|
2000-11-25 22:42:00 +01:00
|
|
|
TTYDRV_BITMAP_DeleteDIBSection,
|
|
|
|
TTYDRV_BITMAP_SetDIBColorTable,
|
2000-12-06 21:15:43 +01:00
|
|
|
TTYDRV_BITMAP_GetDIBColorTable,
|
|
|
|
TTYDRV_BITMAP_Lock,
|
|
|
|
TTYDRV_BITMAP_Unlock
|
1999-04-01 10:16:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
PALETTE_DRIVER TTYDRV_PALETTE_Driver =
|
|
|
|
{
|
|
|
|
TTYDRV_PALETTE_SetMapping,
|
1999-04-10 18:37:43 +02:00
|
|
|
TTYDRV_PALETTE_UpdateMapping,
|
|
|
|
TTYDRV_PALETTE_IsDark
|
1999-04-01 10:16:08 +02:00
|
|
|
};
|
|
|
|
|
1999-02-04 11:10:59 +01:00
|
|
|
/* FIXME: Adapt to the TTY driver. Copied from the X11 driver */
|
|
|
|
|
1999-11-24 00:43:29 +01:00
|
|
|
DeviceCaps TTYDRV_DC_DevCaps = {
|
1999-02-04 11:10:59 +01:00
|
|
|
/* version */ 0,
|
|
|
|
/* technology */ DT_RASDISPLAY,
|
|
|
|
/* size, resolution */ 0, 0, 0, 0, 0,
|
|
|
|
/* device objects */ 1, 16 + 6, 16, 0, 0, 100, 0,
|
|
|
|
/* curve caps */ CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES |
|
|
|
|
CC_WIDE | CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT,
|
|
|
|
/* line caps */ LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
|
|
|
|
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS,
|
|
|
|
/* polygon caps */ PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
|
|
|
|
PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS,
|
|
|
|
/* text caps */ 0,
|
|
|
|
/* regions */ CP_REGION,
|
|
|
|
/* raster caps */ RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 |
|
|
|
|
RC_DI_BITMAP | RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS,
|
|
|
|
/* aspects */ 36, 36, 51,
|
|
|
|
/* pad1 */ { 0 },
|
|
|
|
/* log pixels */ 0, 0,
|
|
|
|
/* pad2 */ { 0 },
|
|
|
|
/* palette size */ 0,
|
|
|
|
/* ..etc */ 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* TTYDRV_GDI_Initialize
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL TTYDRV_GDI_Initialize(void)
|
1999-02-04 11:10:59 +01:00
|
|
|
{
|
1999-04-01 10:16:08 +02:00
|
|
|
BITMAP_Driver = &TTYDRV_BITMAP_Driver;
|
|
|
|
PALETTE_Driver = &TTYDRV_PALETTE_Driver;
|
|
|
|
|
|
|
|
TTYDRV_DC_DevCaps.version = 0x300;
|
|
|
|
TTYDRV_DC_DevCaps.horzSize = 0; /* FIXME: Screen width in mm */
|
|
|
|
TTYDRV_DC_DevCaps.vertSize = 0; /* FIXME: Screen height in mm */
|
|
|
|
TTYDRV_DC_DevCaps.horzRes = 640; /* FIXME: Screen width in pixel */
|
|
|
|
TTYDRV_DC_DevCaps.vertRes = 480; /* FIXME: Screen height in pixel */
|
|
|
|
TTYDRV_DC_DevCaps.bitsPixel = 1; /* FIXME: Bits per pixel */
|
2000-08-10 03:16:19 +02:00
|
|
|
TTYDRV_DC_DevCaps.sizePalette = 256; /* FIXME: ??? */
|
1999-02-04 11:10:59 +01:00
|
|
|
|
|
|
|
/* Resolution will be adjusted during the font init */
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
TTYDRV_DC_DevCaps.logPixelsX = (int) (TTYDRV_DC_DevCaps.horzRes * 25.4 / TTYDRV_DC_DevCaps.horzSize);
|
|
|
|
TTYDRV_DC_DevCaps.logPixelsY = (int) (TTYDRV_DC_DevCaps.vertRes * 25.4 / TTYDRV_DC_DevCaps.vertSize);
|
1999-02-04 11:10:59 +01:00
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
if(!TTYDRV_PALETTE_Initialize())
|
|
|
|
return FALSE;
|
1999-02-04 11:10:59 +01:00
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
return DRIVER_RegisterDriver( "DISPLAY", &TTYDRV_DC_Driver );
|
1999-02-04 11:10:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* TTYDRV_GDI_Finalize
|
|
|
|
*/
|
1999-04-01 10:16:08 +02:00
|
|
|
void TTYDRV_GDI_Finalize(void)
|
1999-02-04 11:10:59 +01:00
|
|
|
{
|
1999-04-01 10:16:08 +02:00
|
|
|
TTYDRV_PALETTE_Finalize();
|
1999-02-04 11:10:59 +01:00
|
|
|
}
|
2000-08-10 03:16:19 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_CreateDC
|
|
|
|
*/
|
|
|
|
BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
|
|
|
|
LPCSTR output, const DEVMODEA *initData)
|
|
|
|
{
|
|
|
|
TTYDRV_PDEVICE *physDev;
|
|
|
|
BITMAPOBJ *bmp;
|
|
|
|
|
|
|
|
TRACE("(%p, %s, %s, %s, %p)\n",
|
|
|
|
dc, debugstr_a(driver), debugstr_a(device),
|
|
|
|
debugstr_a(output), initData);
|
|
|
|
|
|
|
|
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
sizeof(TTYDRV_PDEVICE));
|
|
|
|
if(!dc->physDev) {
|
|
|
|
ERR("Can't allocate physDev\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
physDev = (TTYDRV_PDEVICE *) dc->physDev;
|
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
dc->devCaps = &TTYDRV_DC_DevCaps;
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
if(dc->flags & DC_MEMORY){
|
2000-08-10 03:16:19 +02:00
|
|
|
physDev->window = NULL;
|
|
|
|
physDev->cellWidth = 1;
|
|
|
|
physDev->cellHeight = 1;
|
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
TTYDRV_DC_CreateBitmap(dc->hBitmap);
|
|
|
|
bmp = (BITMAPOBJ *) GDI_GetObjPtr(dc->hBitmap, BITMAP_MAGIC);
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
dc->bitsPerPixel = bmp->bitmap.bmBitsPixel;
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
dc->totalExtent.left = 0;
|
|
|
|
dc->totalExtent.top = 0;
|
|
|
|
dc->totalExtent.right = bmp->bitmap.bmWidth;
|
|
|
|
dc->totalExtent.bottom = bmp->bitmap.bmHeight;
|
|
|
|
dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
|
2000-08-10 03:16:19 +02:00
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
GDI_ReleaseObj( dc->hBitmap );
|
2000-08-10 03:16:19 +02:00
|
|
|
} else {
|
2001-04-25 01:28:52 +02:00
|
|
|
physDev->window = root_window;
|
2000-08-10 03:16:19 +02:00
|
|
|
physDev->cellWidth = cell_width;
|
|
|
|
physDev->cellHeight = cell_height;
|
|
|
|
|
2000-11-05 03:05:07 +01:00
|
|
|
dc->bitsPerPixel = 1;
|
|
|
|
dc->totalExtent.left = 0;
|
|
|
|
dc->totalExtent.top = 0;
|
|
|
|
dc->totalExtent.right = cell_width * screen_cols;
|
|
|
|
dc->totalExtent.bottom = cell_height * screen_rows;
|
|
|
|
dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
|
2000-08-10 03:16:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_DeleteDC
|
|
|
|
*/
|
|
|
|
BOOL TTYDRV_DC_DeleteDC(DC *dc)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", dc);
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, dc->physDev );
|
|
|
|
dc->physDev = NULL;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_Escape
|
|
|
|
*/
|
|
|
|
INT TTYDRV_DC_Escape(DC *dc, INT nEscape, INT cbInput,
|
|
|
|
SEGPTR lpInData, SEGPTR lpOutData)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_DC_SetDeviceClipping
|
|
|
|
*/
|
|
|
|
void TTYDRV_DC_SetDeviceClipping(DC *dc)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", dc);
|
|
|
|
}
|