1999-04-01 10:16:08 +02:00
|
|
|
/*
|
|
|
|
* TTY palette driver
|
|
|
|
*
|
|
|
|
* Copyright 1999 Patrik Stridvall
|
|
|
|
*/
|
|
|
|
|
2000-04-09 20:41:15 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
1999-11-24 00:43:29 +01:00
|
|
|
#include "color.h"
|
|
|
|
#include "debugtools.h"
|
1999-04-01 10:16:08 +02:00
|
|
|
#include "palette.h"
|
2000-04-15 22:44:21 +02:00
|
|
|
#include "winbase.h"
|
1999-04-01 10:16:08 +02:00
|
|
|
#include "ttydrv.h"
|
|
|
|
|
2000-08-10 03:16:19 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(ttydrv);
|
1999-11-24 00:43:29 +01:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
extern DeviceCaps TTYDRV_DC_DevCaps;
|
|
|
|
|
|
|
|
extern PALETTEENTRY *COLOR_sysPal;
|
|
|
|
extern int COLOR_gapStart;
|
|
|
|
extern int COLOR_gapEnd;
|
|
|
|
extern int COLOR_gapFilled;
|
|
|
|
extern int COLOR_max;
|
|
|
|
|
|
|
|
extern const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS];
|
|
|
|
|
|
|
|
/***********************************************************************
|
1999-04-01 10:16:08 +02:00
|
|
|
* TTYDRV_PALETTE_Initialize
|
|
|
|
*/
|
|
|
|
BOOL TTYDRV_PALETTE_Initialize(void)
|
|
|
|
{
|
1999-11-24 00:43:29 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
TRACE("(void)\n");
|
|
|
|
|
2000-04-09 20:41:15 +02:00
|
|
|
COLOR_sysPal = (PALETTEENTRY *) HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * TTYDRV_DC_DevCaps.sizePalette);
|
|
|
|
if(COLOR_sysPal == NULL) {
|
2001-05-09 19:31:31 +02:00
|
|
|
WARN("No memory to create system palette!\n");
|
2000-04-09 20:41:15 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-11-24 00:43:29 +01:00
|
|
|
|
|
|
|
for(i=0; i < TTYDRV_DC_DevCaps.sizePalette; i++ ) {
|
|
|
|
const PALETTEENTRY *src;
|
|
|
|
PALETTEENTRY *dst = &COLOR_sysPal[i];
|
|
|
|
|
|
|
|
if(i < NB_RESERVED_COLORS/2) {
|
|
|
|
src = &COLOR_sysPalTemplate[i];
|
|
|
|
} else if(i >= TTYDRV_DC_DevCaps.sizePalette - NB_RESERVED_COLORS/2) {
|
|
|
|
src = &COLOR_sysPalTemplate[NB_RESERVED_COLORS + i - TTYDRV_DC_DevCaps.sizePalette];
|
|
|
|
} else {
|
|
|
|
PALETTEENTRY pe = { 0, 0, 0, 0 };
|
|
|
|
src = &pe;
|
|
|
|
}
|
|
|
|
|
|
|
|
if((src->peRed + src->peGreen + src->peBlue) <= 0xB0) {
|
|
|
|
dst->peRed = 0;
|
|
|
|
dst->peGreen = 0;
|
|
|
|
dst->peBlue = 0;
|
|
|
|
dst->peFlags = PC_SYS_USED;
|
|
|
|
} else {
|
|
|
|
dst->peRed = 255;
|
|
|
|
dst->peGreen= 255;
|
|
|
|
dst->peBlue = 255;
|
|
|
|
dst->peFlags = PC_SYS_USED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
COLOR_gapStart = NB_RESERVED_COLORS/2;
|
|
|
|
COLOR_gapEnd = NB_RESERVED_COLORS/2;
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-11-24 00:43:29 +01:00
|
|
|
/***********************************************************************
|
1999-04-01 10:16:08 +02:00
|
|
|
* TTYDRV_PALETTE_Finalize
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void TTYDRV_PALETTE_Finalize(void)
|
|
|
|
{
|
1999-11-24 00:43:29 +01:00
|
|
|
TRACE("(void)\n");
|
1999-04-01 10:16:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_PALETTE_SetMapping
|
|
|
|
*/
|
|
|
|
int TTYDRV_PALETTE_SetMapping(
|
|
|
|
PALETTEOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly)
|
|
|
|
{
|
1999-11-24 00:43:29 +01:00
|
|
|
FIXME("(%p, %u, %u, %d): stub\n", palPtr, uStart, uNum, mapOnly);
|
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_PALETTE_UpdateMapping
|
|
|
|
*/
|
|
|
|
int TTYDRV_PALETTE_UpdateMapping(PALETTEOBJ *palPtr)
|
|
|
|
{
|
1999-12-12 00:08:48 +01:00
|
|
|
TRACE("(%p)\n", palPtr);
|
1999-11-24 00:43:29 +01:00
|
|
|
|
1999-04-01 10:16:08 +02:00
|
|
|
return 0;
|
|
|
|
}
|
1999-04-10 18:37:43 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TTYDRV_PALETTE_IsDark
|
|
|
|
*/
|
|
|
|
int TTYDRV_PALETTE_IsDark(int pixel)
|
|
|
|
{
|
1999-11-24 00:43:29 +01:00
|
|
|
FIXME("(%d): stub\n", pixel);
|
|
|
|
|
1999-04-10 18:37:43 +02:00
|
|
|
return 0;
|
|
|
|
}
|