These are found on the clipboard in the biCompression == BI_BITFIELDS &&
biBitCount >= 16 format. In this case the BITMAPINFOHEADER is followed
by three DWORD specifying the masks of the red green and blue components,
but bfOffBits was not being adjusted accordingly.
Based on Massimo's comment on bug 631384 and verified on
http://msdn.microsoft.com/en-us/library/
dd183386%28v=VS.85%29.aspx
https://bugzilla.gnome.org/show_bug.cgi?id=631384
bi->biSize +
bi->biClrUsed * sizeof (RGBQUAD));
+ if (bi->biCompression == BI_BITFIELDS && bi->biBitCount >= 16)
+ {
+ /* Screenshots taken with PrintScreen or
+ * Alt + PrintScreen are found on the clipboard in
+ * this format. In this case the BITMAPINFOHEADER is
+ * followed by three DWORD specifying the masks of the
+ * red green and blue components, so adjust the offset
+ * accordingly. */
+ bf->bfOffBits += (3 * sizeof (DWORD));
+ }
+
memcpy ((char *) data + sizeof (BITMAPFILEHEADER),
bi,
data_length);