OpenImageIO/oiio — pull request #687 by lgritz (2013-10-06 19:37:56+00:00)
Title: ImageBuf internals refactor (minor)

* I noticed that when using ImageBuf::write(), it's hard to control a few aspects of it, so this patch adds ImageBuf::set_write_format(TypeDesc) and ImageBuf::set_write_tiles(int,int,int) that serve to let you explicitly request that an IB perform any future write() output with that format and/or tile sizes rather than its default choices. Note that this may be completely different than the internal tiling or data format of the buffer itself (hence the confusion).

* To avoid some funny order-of-operation situations, we now rig ImageBufs that are constructed (or reset) to read from files to immediately set themselves up as reading from the ImageCache (including understanding their specs). It can later be forced to allocate local memory and read the full file, by calling IB::read(...,force=true). But this makes it so that if the file exists, the IB will never look "uninitialized." This doesn't really change anything about the use, or the efficiency, it just guarantees that reading-IB always looks initialized and has a valid spec from the very beginning.

* A few checkins ago, we added write() as a preferred synonym for the now-deprecated save(), and also deprecated the IB constructors that name a write-only buffer (i.e., gave them names even though no file I/O was ever intended). This patch cleans up all the places in OIIO where we used the deprecated calls, switching them to the new preferred calls -- IB constructors with a spec no longer passes a name, and use write() rather than save().