Use top-to-bottom coordinates in DIB section

This commit is contained in:
Ioannis Tsakpinis 2015-09-07 16:01:23 +03:00
parent cca7589486
commit cc340c7c72

View File

@ -743,7 +743,7 @@ static HICON createIcon(GLFWimage* image)
// fill in BITMAPV5HEADER to pass to CreateDIBSection // fill in BITMAPV5HEADER to pass to CreateDIBSection
header.bV5Size = sizeof(header); header.bV5Size = sizeof(header);
header.bV5Width = image->width; header.bV5Width = image->width;
header.bV5Height = image->height; header.bV5Height = -image->height;
header.bV5Planes = 1; header.bV5Planes = 1;
header.bV5BitCount = 32; header.bV5BitCount = 32;
header.bV5Compression = BI_BITFIELDS; header.bV5Compression = BI_BITFIELDS;
@ -758,7 +758,6 @@ static HICON createIcon(GLFWimage* image)
ReleaseDC(NULL, hdc); ReleaseDC(NULL, hdc);
// first we need to convert RGBA to BGRA (yay Windows!) // first we need to convert RGBA to BGRA (yay Windows!)
// we also need to convert lines, because Windows wants bottom-to-top RGBA
BGRAData = calloc(1, image->width * image->height * 4); BGRAData = calloc(1, image->width * image->height * 4);
for (i = 0; i < image->width * image->height; i++) for (i = 0; i < image->width * image->height; i++)