swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
490 stars 31 forks source link

Draft: Optionally submit 10 bit buffers #54

Open mstoeckl opened 1 year ago

mstoeckl commented 1 year ago

This PR builds on top of !53, and makes Swaybg submit 10-bit buffers when the background image it is given is a 16-bit deep PNG file. (#53 is necessary since Cairo does not have an equivalent to CAIRO_FORMAT_RGB30 with an alpha channel; without #53, this code would render transparent 8-bit PNGs with alpha and 16-bit PNGs without.)

Note: loading 16-bit PNG images gave incorrect results with Cairo 1.17.2 through 1.17.5. Since 16 bit PNG images are rare, and most distributions either use stable releases (latest 1.16.0), or development snapshots (latest 1.17.6), this bug is unlikely to affect anyone. Cairo versions before 1.17.2 reduce 16-bit PNG files to 8-bit on loading; swaybg will continue to submit 8-bit buffers for these.