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

📄 sd3232.h

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 H
字号:
//
// Windows CE Software Graphics Library
// sd3232.h
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This header file contains the function template for special case blit
// routines with 32 bit source and 32 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(DWORD_OP)
#error Must define either BLOCK_OP or DWORD_OP
#endif

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

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

  // Source-related info.

  const RECT * SrcRect = Parameters->SourceRect;
  LONG         SrcScanStride = Parameters->Source->Stride / sizeof(DWORD);
  DWORD      * SrcScanLine  = (DWORD *)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;

#ifdef DWORD_OP

  DWORD * DstPixel;
  DWORD * SrcPixel;
  DWORD * 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 DWORD_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 = DWORD_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 = DWORD_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(DWORD));
    SrcScanLine += SrcScanStride;
    DstScanLine += DstScanStride;
  }
#endif

  return TRUE;
}

⌨️ 快捷键说明

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