png: Add support for writing new floating point formats as 16 bpc png

Graphics / Cairo - Maarten Lankhorst [linux.intel.com] - 8 January 2019 03:14 EST

_cairo_image_surface_coerce will round down the image to a lower bpp when using one of the floating point formats, so don't coerce those. This makes the code actually work for those formats.

Because a float takes more storage than u16, we have to convert float to u16 before calling png_write_image, because png_write doesn't give us back the original row data, but an in-place copy.

With these changes we can dump floating point files with the highest possible accuracy, with floats clamped between 0 and 1.

1df0a6846 png: Add support for writing new floating point formats as 16 bpc png.
src/cairo-png.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 97 insertions(+), 11 deletions(-)

Upstream: cgit.freedesktop.org


  • Share