⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sd0832.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
//
// Windows CE Software Graphics Library
// sd0832.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This header file contains the function template for the special blit case
// of 8 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;

  // 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;

  DWORD * DstPixel;
  BYTE * SrcPixel;
  DWORD * Lim;

  ULONG i;

  DWORD Palette[256];

  // Check parameters.

  // !TODO!

  // Pre-transform the 8Bpp 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 < 256; i++) {

    Palette[i] = ColorConvert(i);
  }

  CleanupColorConverter(); 

  for (Row = 0; Row < Rows; Row++) {

    DstPixel = DstScanLine;
    SrcPixel = SrcScanLine;
    Lim      = DstPixel + Cols;

    while (DstPixel < Lim) {

      *DstPixel = DWORD_OP(*DstPixel, Palette[*SrcPixel]);
      DstPixel++;
      SrcPixel++;
    }

    SrcScanLine += SrcScanStride;
    DstScanLine += DstScanStride;
  }

  return TRUE;
}

⌨️ 快捷键说明

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