-1
我想創建一個DIBSection以便能夠更快地渲染像素,因爲SetPixel太慢了。現在,我想,像這樣創建:CreateDibSection拋出訪問衝突異常
void** imagePointer = NULL;
DWORD mask888[] = { 0xFF0000, 0x00FF00, 0x0000FF };
BITMAPINFO bitmapInfo = BITMAPINFO();
memset(&bitmapInfo, 0, sizeof(bitmapInfo));
memcpy(bitmapInfo.bmiColors, mask888, sizeof(mask888));
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.bmiHeader.biWidth = LCD_WIDTH; // 160
bitmapInfo.bmiHeader.biHeight = LCD_HEIGHT; // 144
bitmapInfo.bmiHeader.biPlanes = 1;
bitmapInfo.bmiHeader.biBitCount = 32;
bitmapInfo.bmiHeader.biCompression = BI_RGB;
bitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, imagePointer, NULL, 0);
但發生的事情是,我剛剛得到正在執行CreateDIBSection呼叫時拋出的訪問衝突異常。
所引發的異常是:
Exception thrown at 0x76E69623 (gdi32.dll) in Emulation.exe: 0xC0000005: Access violation writing location 0x0000FF00.
你能告訴我如何調試這個或如何解決這個問題?
非常感謝您提前!
非常感謝你。 – Andreas