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

Fix Flipbook Color Mask When Viewing TLV Files #2537

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 21 additions & 15 deletions toonz/sources/toonzlib/imagepainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,26 +394,22 @@ void Painter::doFlushRasterImages(const TRasterP &rin, int bg,

bool showChannelsOnMatte =
(chan != TRop::MChan && chan != 0 && !m_vSettings.m_greytones);
if ((!showChannelsOnMatte && !m_vSettings.m_useTexture && chan != 0) ||
(!showChannelsOnMatte && m_vSettings.m_useTexture &&
(chan == TRop::MChan || m_vSettings.m_greytones))) {
TRasterP app = _rin->create(_rin->getLx(), _rin->getLy());
try {
TRop::setChannel(_rin, app, chan, m_vSettings.m_greytones);
if (!m_vSettings.m_useTexture)
_rin = app;
else
ras = app;
} catch (...) {
}
}

if (m_vSettings.m_useTexture) {
TRaster32P checkBoardRas = buildCheckboard(bg, _rin->getSize());
GLRasterPainter::drawRaster(aff, checkBoardRas->getRawData(),
checkBoardRas->getWrap(), 4,
checkBoardRas->getSize(), true);
if (showChannelsOnMatte) ras = keepChannels(_rin, m_palette, chan);
if (showChannelsOnMatte)
ras = keepChannels(_rin, m_palette, chan);
else if (chan == TRop::MChan || m_vSettings.m_greytones) {
TRasterP app = ras->create(ras->getLx(), ras->getLy());
try {
TRop::setChannel(ras, app, chan, m_vSettings.m_greytones);
ras = app;
} catch (...) {
}
}
GLRasterPainter::drawRaster(aff, ras->getRawData(), ras->getWrap(), 4,
ras->getSize(), true);
ras->unlock();
Expand All @@ -437,9 +433,19 @@ void Painter::doFlushRasterImages(const TRasterP &rin, int bg,
quickput(ras, keepChannels(_rin, m_palette, chan), m_palette,
m_vSettings.m_useTexture ? TAffine() : aff * TTranslation(offs),
m_vSettings.m_useChecks);
else
else if (chan != 0) {
TRasterP app = ras->create(_rin->getLx(), _rin->getLy());
quickput(app, _rin, m_palette, TAffine(), m_vSettings.m_useChecks);
try {
TRop::setChannel(app, app, chan, m_vSettings.m_greytones);
} catch (...) {
}
quickput(ras, app, m_palette, aff * TTranslation(offs),
m_vSettings.m_useChecks);
} else {
quickput(ras, _rin, m_palette, aff * TTranslation(offs),
m_vSettings.m_useChecks);
}

glDisable(GL_BLEND);

Expand Down