📄 sd1616.h
字号:
//
// Windows CE Software Graphics Library
// sd1616.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This header file contains the function template for special case blit
// routines with 16 bit source and 16 bit destination surfaces. This code
// does not stretch, colorkey, mask, clip, blend, or do color conversions.
#if !defined(FUNCTION)
#error Must define FUNCTION
#endif
#if !defined(BLOCK_OP) && !defined(WORD_OP)
#error Must define either BLOCK_OP or WORD_OP
#endif
#if defined(BLOCK_OP) && defined(WORD_OP)
#error Cannot define both BLOCK_OP and WORD_OP
#endif
BOOL
FUNCTION(
BLT_PARAM * Parameters
)
{
// Local variables.
// Source-related info.
const RECT * SrcRect = Parameters->SourceRect;
LONG SrcScanStride = Parameters->Source->Stride / sizeof(WORD);
WORD * SrcScanLine = (WORD *)Parameters->Source->Ptr +
SrcRect->top * SrcScanStride +
SrcRect->left;
// Destination-related info.
const RECT * DstRect = Parameters->DestRect;
LONG DstScanStride = Parameters->Destination->Stride / sizeof(WORD);
WORD * DstScanLine = (WORD *)Parameters->Destination->Ptr +
DstRect->top * DstScanStride +
DstRect->left;
ULONG Rows = RectHeight(DstRect);
ULONG Cols = RectWidth(DstRect);
ULONG Row;
#ifdef WORD_OP
WORD * DstPixel;
WORD * SrcPixel;
WORD * Lim;
#endif
// Check parameters.
// !TODO!
// Make sure to copy source before overwriting.
if (!Parameters->ScanYPositive) {
// Scan from end of memory, and negate stride.
SrcScanLine += SrcScanStride * (Rows - 1);
DstScanLine += DstScanStride * (Rows - 1);
SrcScanStride = -SrcScanStride;
DstScanStride = -DstScanStride;
}
#ifdef WORD_OP
if (!Parameters->ScanXPositive) {
// Copy from right to left
for (Row = 0; Row < Rows; Row++) {
DstPixel = DstScanLine + Cols - 1;
SrcPixel = SrcScanLine + Cols - 1;
while (DstPixel >= SrcScanLine) {
*DstPixel = WORD_OP(*DstPixel, *SrcPixel);
DstPixel--;
SrcPixel--;
}
SrcScanLine += SrcScanStride;
DstScanLine += DstScanStride;
}
}
else {
// Copy from left to right
for (Row = 0; Row < Rows; Row++) {
DstPixel = DstScanLine;
SrcPixel = SrcScanLine;
Lim = DstPixel + Cols;
while (DstPixel < Lim) {
*DstPixel = WORD_OP(*DstPixel, *SrcPixel);
DstPixel++;
SrcPixel++;
}
SrcScanLine += SrcScanStride;
DstScanLine += DstScanStride;
}
}
#endif
#ifdef BLOCK_OP
// Do the copy line by line rather than by pixel.
for (Row = 0; Row < Rows; Row++) {
BLOCK_OP(DstScanLine, SrcScanLine, Cols * sizeof(WORD));
SrcScanLine += SrcScanStride;
DstScanLine += DstScanStride;
}
#endif
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -