I am writing code to retrieve image data from OpenGL into a GDI+ Bitmap. While doing so I ran into something odd.
Given the following definitions:
Gdiplus::Rect gRect(0, 0, 1225, 753);
The following call returns a stride of 4900 in bmData:
LockBits(&gRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppRGB, &bmData);
The following call returns a stride of 4904 in bmData:
LockBits(&gRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppPARGB, &bmData);
Only the pixel format has changed, and in both cases the pixel format is 32-bit, but the stride is bigger than it needs to be for the second scenario. Also, using PixelFormat32bppARGB works similarly to the first version (stride is 4900).
I'm not sure if the data matches the stride, or if the stride is incorrectly calculated. Does anyone know?