Skip to content

wingdi: fix handling of 256 color depth

Jeffrey Knockel requested to merge jeffk/vlc:gdi-256-color-fixes into master

On Windows, 256 color bitmaps always have color palettes. Prior to this change, we wrote out 8bpp RGB bytes where GDI instead expected 8-bit palette indexes. Worse, we did not allocate memory for the palette, and so GDI would read palette entries outside the end of the vout_display_sys_t struct. Since GDI will happily convert to and from bitmaps of differing depths, we now write out a 24bpp bitmap for 256 color screen depths and let GDI convert to the paletted format.

In this commit, we also implement a similar fix for GDI screen capturing.

Merge request reports