📄 sd0432.h
字号:
//
// Windows CE Software Graphics Library
// sd0432.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This header file contains the function template for the special blit case
// of 4 Bpp source and 32 Bpp destination. This code will do the appropriate
// lookup and conversion, but not stretch, colorkey, mask, clip, or blend.
#if !defined(FUNCTION)
#error Must define FUNCTION
#endif
#if !defined(DWORD_OP)
#error Must define DWORD_OP
#endif
BOOL
FUNCTION(
BLT_PARAM * Parameters
)
{
// Local variables.
// Source-related info.
const RECT * SrcRect = Parameters->SourceRect;
LONG SrcScanStride = Parameters->Source->Stride;
BYTE * SrcScanLine = (BYTE *)Parameters->Source->Ptr +
SrcRect->top * SrcScanStride +
(SrcRect->left >> 1);
// Destination-related info.
const RECT * DstRect = Parameters->DestRect;
LONG DstScanStride = Parameters->Destination->Stride / sizeof(DWORD);
DWORD * DstScanLine = (DWORD *)Parameters->Destination->Ptr +
DstRect->top * DstScanStride +
DstRect->left;
ULONG Rows = RectHeight(DstRect);
ULONG Cols = RectWidth(DstRect);
ULONG Row;
ULONG Col;
DWORD Palette[16];
ULONG i;
BYTE * SrcPixel;
DWORD * DstPixel;
BYTE SrcValue;
BOOL Odd;
// Check parameters.
// !TODO!
// Pre-transform the 4Bpp palette into our color format so that we can just
// do a straight lookup per-pixel.
if (!InitColorConverter(Parameters->Source->Format,
Parameters->Destination->Format)) {
return FALSE;
}
for (i = 0; i < 16; i++) {
Palette[i] = ColorConvert(i);
}
CleanupColorConverter();
for (Row = 0; Row < Rows; Row++) {
// Set up pointers to first bytes on source and destination scanlines.
SrcPixel = SrcScanLine;
DstPixel = DstScanLine;
Odd = SrcRect->left & 1;
for (Col = 0; Col < Cols; Col++) {
if (Odd) SrcValue = *SrcPixel++ & 0xF;
else SrcValue = *SrcPixel >> 4;
Odd = !Odd;
*DstPixel++ = DWORD_OP(*DstPixel, Palette[SrcValue]);
}
// Advance to next scanline.
SrcScanLine += SrcScanStride;
DstScanLine += DstScanStride;
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -