DirectDraw 编程的基础问题,StretchDIBits 速度好慢
我想在屏幕上输出 pOriY 里的图片,用 StretchDIBits 速度好慢,请问有什么办法可以加快速度?能否绕开 StretchDIBits ?
for(i = 0; i < iWidth; i++)
for(j = 0; j < iHeight; j++)
pOriY[i + iWidth * j] = RGB[0, 0, 255];
BITMAPINFOHEADER bi;
BYTE *pic = (BYTE*)pOriY;
bi.biSize = sizeof( BITMAPINFOHEADER );
bi.biWidth = 320;
bi.biHeight = 240;
bi.biPlanes = 1;
bi.biBitCount = 32;
bi.biCompression = BI_RGB;
bi.biSizeImage = 320 * 240 * 4 ;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0;
bi.biClrImportant = 0;
HDC hdc;
lpDDSBack->GetDC(&hdc);
SetStretchBltMode(hdc, STRETCH_HALFTONE);
StretchDIBits( hdc , //hDC
0, //DestX
0,//DestY
320, //DestWidth
240, //DestHeight
0 , //SrcX
0 , //SrcY
320 , //SrcWidth
240 , //SrcHeight
pic, //lpBits
(LPBITMAPINFO)&bi, //lpBitsInfo
DIB_RGB_COLORS , //wUsage
SRCCOPY);
lpDDSBack->ReleaseDC( hdc );
lpDDSPrimary->BltFast(r.left + 1, r.top + 1, lpDDSBack, NULL, 0);
lpDDSBack->Restore();