xsl_vd_setpalette.cpp

来自「X-scale 27x 平台」· C++ 代码 · 共 73 行

CPP
73
字号
//
// Copyright (c) Chrontel Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Chrontel end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name:
   vd_SetPalette.cpp
Abstract:

Functions:

Notes:

Revision:
   12/20/02, Roger Yu, Create the file
--*/

#include	"precomp.h"

#include	"XSLGPE.h"

//#include	"vga.h"
#include	"palette.h"	// for 8Bpp we use the natural palette
//#include	"bootarg.h"
#ifdef CLEARTYPE
#include   <ctblt.h>
#endif //CLEARTYPE

#ifdef _ARM_  // for XScale PXA2xx processor video driver

SCODE	XSLGPE::SetPalette(const PALETTEENTRY *source, USHORT firstEntry, USHORT numEntries)
{
	DEBUGMSG (GPE_ZONE_INIT, (TEXT("XSLGPE::SetPalette\r\n")));

	if (firstEntry < 0 || firstEntry + numEntries > 256 || source == NULL)
	{
		return	E_INVALIDARG;
	}

	int i;
	int end = firstEntry + numEntries;

	i = lcdPaletteSize>>1;
	end = (end>i)? i:end;

    // Store the palette entries into palette ram
	for(i=firstEntry;i<end;i++) 
	{
		// store 5 bits red, 6 bits green, and 5 bits blue
		v_pPaletteBuffer->palette[i] = (
			(source[i].peBlue)			>>  3	|
			((source[i].peGreen & 0xfc)	<<  3)	|
			((source[i].peRed	& 0xf8)	<<  8)
			);
	}


	return	S_OK;
}


#endif   // _ARM_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?