Correctly create the byte array of gif images to match what

CreateDIBitmap expects.
This commit is contained in:
Maxime Bellengé 2004-05-10 19:56:34 +00:00 committed by Alexandre Julliard
parent c77788b59f
commit 426b02362b
1 changed files with 11 additions and 8 deletions

View File

@ -942,6 +942,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
ColorMapObject *cm;
int transparent = -1;
ExtensionBlock *eb;
int padding;
gd.data = xbuf;
gd.curoff = 0;
@ -965,8 +966,9 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
gif->Image.Interlace
);
/* */
padding = (gif->SWidth+3) & ~3;
bmi = HeapAlloc(GetProcessHeap(),0,sizeof(BITMAPINFOHEADER)+(1<<gif->SColorResolution)*sizeof(RGBQUAD));
bytes= HeapAlloc(GetProcessHeap(),0,gif->SWidth*gif->SHeight);
bytes= HeapAlloc(GetProcessHeap(),0,padding*gif->SHeight);
si = gif->SavedImages+0;
gid = &(si->ImageDesc);
cm = gid->ColorMap;
@ -995,15 +997,16 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
/* Map to in picture coordinates */
for (i=0;i<gid->Height;i++)
for (j=0;j<gid->Width;j++)
bytes[(gid->Top+(gif->SHeight-i-1))*gif->SWidth+gid->Left+j]=si->RasterBits[i*gid->Width+j];
for (j=0;j<gid->Width;j++)
bytes[(gid->Top+i)*(padding)+gid->Left+j]=si->RasterBits[i*gid->Width+j];
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = gif->SWidth;
bmi->bmiHeader.biHeight = gif->SHeight;
bmi->bmiHeader.biHeight = -gif->SHeight;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = 8;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = gif->SWidth*gif->SHeight;
bmi->bmiHeader.biSizeImage = padding*gif->SHeight;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 1 << gif->SColorResolution;