palette.c revision e64031e20c39650a7bc902a3e1aba613b9415dee
/******************************Module*Header*******************************\
*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*
* Based in part on Microsoft DDK sample code
*
* *******************
* * GDI SAMPLE CODE *
* *******************
*
* Module Name: palette.c
*
* Palette support.
*
* Copyright (c) 1992-1998 Microsoft Corporation
\**************************************************************************/
#include "driver.h"
// Global Table defining the 20 Window Default Colors. For 256 color
// palettes the first 10 must be put at the beginning of the palette
// and the last 10 at the end of the palette.
{
{ 0, 0, 0, 0 }, // 0
{ 0x80,0, 0, 0 }, // 1
{ 0, 0x80,0, 0 }, // 2
{ 0x80,0x80,0, 0 }, // 3
{ 0, 0, 0x80,0 }, // 4
{ 0x80,0, 0x80,0 }, // 5
{ 0, 0x80,0x80,0 }, // 6
{ 0xC0,0xC0,0xC0,0 }, // 7
{ 192, 220, 192, 0 }, // 8
{ 166, 202, 240, 0 }, // 9
{ 255, 251, 240, 0 }, // 10
{ 160, 160, 164, 0 }, // 11
{ 0x80,0x80,0x80,0 }, // 12
{ 0xFF,0, 0 ,0 }, // 13
{ 0, 0xFF,0 ,0 }, // 14
{ 0xFF,0xFF,0 ,0 }, // 15
{ 0 ,0, 0xFF,0 }, // 16
{ 0xFF,0, 0xFF,0 }, // 17
{ 0, 0xFF,0xFF,0 }, // 18
{ 0xFF,0xFF,0xFF,0 }, // 19
};
/******************************Public*Routine******************************\
* bInitPaletteInfo
*
* Initializes the palette information for this PDEV.
*
* Called by DrvEnablePDEV.
*
\**************************************************************************/
{
return(FALSE);
return(TRUE);
}
/******************************Public*Routine******************************\
* vDisablePalette
*
* Frees resources allocated by bInitPaletteInfo.
*
\**************************************************************************/
{
// Delete the default palette if we created one.
if (ppdev->hpalDefault)
{
}
}
/******************************Public*Routine******************************\
* bInitDefaultPalette
*
* Initializes default palette for PDEV.
*
\**************************************************************************/
{
{
//
// Allocate our palette
//
DISPDBG((0, "DISP bInitDefaultPalette() failed EngAllocMem\n"));
return(FALSE);
}
//
// Generate 256 (8*4*4) RGB combinations to fill the palette
//
{
if (!(jRed += 32))
if (!(jGre += 32))
jBlu += 64;
}
//
// Fill in Windows Reserved Colors from the WIN 3.0 DDK
// The Window Manager reserved the first and last 10 colors for
// painting windows borders and for non-palette managed applications.
//
{
//
// First 10
//
//
// Last 10
//
}
//
// Create handle for palette.
//
ppdev->hpalDefault =
256,
0,0,0);
{
DISPDBG((0, "DISP bInitDefaultPalette failed EngCreatePalette\n"));
return(FALSE);
}
//
// Initialize the hardware with the initial palette.
//
return(TRUE);
} else {
ppdev->hpalDefault =
{
DISPDBG((0, "DISP bInitDefaultPalette failed EngCreatePalette\n"));
return(FALSE);
}
}
return(TRUE);
}
/******************************Public*Routine******************************\
* bInit256ColorPalette
*
* Initialize the hardware's palette registers.
*
\**************************************************************************/
{
{
//
// Fill in pScreenClut header info:
//
pScreenClut->FirstEntry = 0;
//
// Copy colours in:
//
cColors = 256;
while(cColors--)
{
}
//
// Set palette registers:
//
NULL,
0,
{
DISPDBG((0, "Failed bEnablePalette"));
return(FALSE);
}
}
return(TRUE);
}
/******************************Public*Routine******************************\
* DrvSetPalette
*
* DDI entry point for manipulating the palette.
*
\**************************************************************************/
{
//
// Fill in pScreenClut header info:
//
(ULONG*) pScreenClutData))
{
DISPDBG((0, "DrvSetPalette failed PALOBJ_cGetColors\n"));
return (FALSE);
}
//
// Set the high reserved byte in each palette entry to 0.
// Do the appropriate palette shifting to fit in the DAC.
//
if (ppdev->cPaletteShift)
{
while(cColors--)
{
}
}
else
{
while(cColors--)
{
}
}
//
// Set palette registers
//
NULL,
0,
&cColors))
{
DISPDBG((0, "DrvSetPalette failed EngDeviceIoControl\n"));
return (FALSE);
}
return(TRUE);
}