I need to create a bitamp in memory, and draw to it myself without using GDI. I can create the bitmap and allocate its buffer using the following code:
bi.biHeight=-hite; //top-down format
This creates a high-color DIB section, and psurface points to the start of bitmap buffer. Now I can also allocate psurface this way:
My question is, if I use GDI to copy the image onto the screen, which way of allocating the bitmap buffer will result in better performance ?
I've tried allocating the buffer both ways and timed the speed of StretchDIBits(), and there's no difference. I'm just thinking, is there any circumstance where one way of allocating the buffer will result in faster GDI performance than the other ?
When you call CreateDIBSection(), the system can know that mostly likely, you're creating a bitmap buffer which will be used by GDI in some way. Can it do something that makes GDI operations on this bitmap faster ? Of course, if CreateDIBSection() calls VirtualAlloc() internally, then there should be no performance difference.