Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ImageBuf): IB::pixeltype() did not always return the right value (#…
…4614) The implementation of IB::pixeltype() was: - Make sure at least the spec had been read (lazy read). - If there are "local pixels", return the pixel type from the spec, otherwise return the cache pixel type. But there is a flaw in this logic: If only the metadata has been read but not the pixels, the local pixels might not be allocated yet, but also there is not a cache and no cached pixel type, so pixeltype() will return UNKNOWN even though we do already know what type of pixels will be stored when they are eventually read. The correct logic is: - Make sure at least the spec had been read (lazy read). - If it's a cached image, return the cache pixel type, otherwise return the pixel type from the spec (which will be correct because we definitely have read the spec at this point). Also, for legit cached images, ensure that cachedpixeltype is set upon read_spec() and doesn't have to wait for a full read(). Signed-off-by: Larry Gritz <[email protected]>
- Loading branch information