Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IB: Fix bug in propagating unassociated alpha behavior request #2172

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/libOpenImageIO/imagebuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,13 +948,18 @@ ImageBufImpl::read(int subimage, int miplevel, int chbegin, int chend,
// loss of range or precision resulting from going through the
// cache. Or the caller requested a forced read, for that case we
// also do a direct read now.
int unassoc = 0;
if (m_imagecache->getattribute("unassociatedalpha", unassoc)) {
// Since IB needs to act as if it's backed by an ImageCache,
// even though in this case we're bypassing the IC, we need to
// honor the IC's "unassociatedalpha" flag.
add_configspec();
m_configspec->attribute("oiio:UnassociatedAlpha", unassoc);
if (!m_configspec
|| !m_configspec->find_attribute("oiio:UnassociatedAlpha")) {
int unassoc = 0;
if (m_imagecache->getattribute("unassociatedalpha", unassoc)) {
// Since IB needs to act as if it's backed by an ImageCache,
// even though in this case we're bypassing the IC, we need
// to honor the IC's "unassociatedalpha" flag. But only if
// this IB wasn't already given a config spec that dictated
// a specific unassociated alpha behavior.
add_configspec();
m_configspec->attribute("oiio:UnassociatedAlpha", unassoc);
}
}
auto in = ImageInput::open(m_name.string(), m_configspec.get());
bool ok = true;
Expand Down