OpenImageIO/oiio — pull request #364 by lgritz (2012-05-29 22:35:52+00:00)
Title: Review: Revert recent change with TIFFdOpen -- it breaks subimage appending.

Brecht's recent changes to support Windows UTF-8 filenames broke maketx by somehow breaking TIFF output append mode, and thus not outputting subimage (MIP levels!) correctly.

This restores that critical section to the old way, until Brecht can find a solution -- I tried for a while, failed, and don't have time to pursue it further at this moment.

Here's a comment I added to the code that explains the situation.

// The following code was proposed by Brecht Van Lommel, going through
// Filesystem::fopen in order to take advantage of correct handling of
// UTF-8 filenames in Windows (which TIFFOpen doesn't do).
// Looked good on paper, but for some reason, the code below does NOT
// correctly handle "a" append mode, which means that writing multiple
// subimages breaks, which in turn renders 'maketx' useless! Though
// since it doesn't return an error code, you don't know that until your
// texturing looks bad and you realize it's because there's only one
// level of the MIPmap output. Ugh!
// I (lg) played with it for a while and couldn't find a solution.
// Our bug? Bug in libtiff? Who knows? Back in your court, Brecht.
// When you find a solution, we can re-enable this code. Easy to test
// by simply doing 'maketx input.tif -o output.tif' and then
// 'iinfo -v output.tif' to verify whether MIP levels are present.