-
Notifications
You must be signed in to change notification settings - Fork 645
Description
Describe the bug
Since the initial commit[1], WebP output has had an unfortunate design flaw during the write_scanline sequence. It was assuming that writing the "last" scanline (the scanline associated with the height - 1 row) meant that writing was complete. It would trigger alpha/sRGB conversion and write out to the filesystem as soon as this scanline was written.
This is wrong as the design of write_scanline enforces no such requirement to do this and consumers of the library can be very surprised if they call this public method themselves while writing the scanlines in different orders.
WebP writing should be refactored to, probably, do most of the final processing on close instead. The write_complete_data function was added recently[2] to at least factor out the logic into a separate place and perhaps that can be used directly in the refactor.
[1]
OpenImageIO/src/webp.imageio/webpoutput.cpp
Line 150 in 5625a76
| if (y == m_spec.height - 1) |
[2] 1cec592