Fix Fl_WinAPI_System_Driver::paste() when clipboard contains GIF image

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12878 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2018-04-29 11:02:34 +00:00
parent ba4559701f
commit 7dba27a404

View File

@ -822,14 +822,12 @@ void Fl_WinAPI_System_Driver::paste(Fl_Widget &receiver, int clipboard, const ch
}
}
} else { // the system will decode a complex DIB
void *pDIBBits = (void *)(lpBI->bmiColors);
void *pDIBBits = (void *)(lpBI->bmiColors + 256);
if (lpBI->bmiHeader.biCompression == BI_BITFIELDS)
pDIBBits = (void *)(lpBI->bmiColors + 3);
else if (lpBI->bmiHeader.biClrUsed > 0)
pDIBBits = (void *)(lpBI->bmiColors + lpBI->bmiHeader.biClrUsed);
Fl_Image_Surface *surf = new Fl_Image_Surface(width, height);
//fprintf(LOG,"complex DIB surf=%p biCompression=%d BI_BITFIELDS=%d biClrUsed=%d\n",
// surf,lpBI->bmiHeader.biCompression,BI_BITFIELDS,lpBI->bmiHeader.biClrUsed);fflush(LOG);
Fl_Surface_Device::push_current(surf);
SetDIBitsToDevice((HDC)fl_graphics_driver->gc(), 0, 0, width, height, 0, 0, 0, height, pDIBBits, lpBI, DIB_RGB_COLORS);
rgb = fl_read_image(NULL, 0, 0, width, height);