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

📄 pdc08.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
//
// Windows CE Software Graphics Library
// pdc08.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This header file contains the function template for special case blit
// fill routines with 8 Bpp destinations and constant fill values.

#if !defined(FUNCTION)
#error Must define FUNCTION
#endif

#if !defined(BLOCK_OP) && !defined(BYTE_OP)
#error Must define either BLOCK_OP or BYTE_OP
#endif

#if defined(BLOCK_OP) && defined(BYTE_OP)
#error Cannot define both BLOCK_OP and BYTE_OP
#endif

BOOL 
FUNCTION(
  BLT_PARAM * Parameters
  )
{
  // Local variables.

  // Destination-related info.

  const RECT * DstRect = Parameters->DestRect;
  LONG         DstScanStride  = Parameters->Destination->Stride;
  BYTE       * DstScanLine = (BYTE *)Parameters->Destination->Ptr +
                             DstRect->top * DstScanStride  +
                             DstRect->left;

  BYTE Color = (BYTE)Parameters->FillValue;

  ULONG Rows = RectHeight(DstRect);
  ULONG Cols = RectWidth(DstRect);

  ULONG Row;

#ifdef BYTE_OP

  BYTE * DstPixel;
  BYTE * Lim;

  // Calculate number of leading bytes, middle bytes of dwords, and
  // trailing bytes.

  LONG LeftBytes = min(4 - (((DWORD)DstScanLine) & 0x03), (DWORD)Cols) & 0x03;
  LONG MiddleDwrods = (Cols - LeftBytes) & ~0x03;
  LONG RightBytes  = Cols - LeftBytes - MiddleDwrods;

  // Replicate the fill value across a dword.

  DWORD DwordColor = Color;
  DwordColor |= DwordColor << 8;
  DwordColor |= DwordColor << 16;

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

    DstPixel = DstScanLine;

    // Do left bytes.

    Lim = DstPixel + LeftBytes;
    while (DstPixel < Lim) {

      *DstPixel = BYTE_OP(*DstPixel, Color);
      DstPixel++;
    }

    // Do middle dwords.

    Lim = DstPixel + MiddleDwrods;

#ifdef defined(PPC821) || defined(PPC403) || !defined(DWORD_OP)

    while (DstPixel < Lim) {

      *DstPixel = BYTE_OP(*DstPixel, Color);
      DstPixel++;
    }

#else

    while (DstPixel < Lim) {

      *(DWORD *)DstPixel = DWORD_OP(*(DWORD *)DstPixel, DwordColor);
      DstPixel += 4;
    }

#endif

    // Do right bytes.

    Lim = DstPixel + RightBytes;

    while (DstPixel < Lim) {

      *DstPixel = BYTE_OP(*DstPixel, Color);
      DstPixel++;
    }

    DstScanLine += DstScanStride;
  }

#endif

#ifdef BLOCK_OP

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

    BLOCK_OP(DstScanLine, Color, Cols);
    DstScanLine += DstScanStride;
  }

#endif

  return TRUE;
}

⌨️ 快捷键说明

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