Skip to content
Permalink
Browse files

Be extra careful about never ever binding null textures when drawing …

…backgrounds. See #11243
  • Loading branch information...
hrydgard committed Jul 21, 2018
1 parent 9be6b22 commit e51ea856150bab6fad10401614c3de1e54c89520
Showing with 9 additions and 6 deletions.
  1. +9 −6 UI/MainScreen.cpp
@@ -1079,17 +1079,20 @@ bool MainScreen::DrawBackgroundFor(UIContext &dc, const std::string &gamePath, f
return false;
}

Draw::Texture *texture = nullptr;
if (ginfo->pic1.texture) {
dc.GetDrawContext()->BindTexture(0, ginfo->pic1.texture->GetTexture());
texture = ginfo->pic1.texture->GetTexture();
} else if (ginfo->pic0.texture) {
dc.GetDrawContext()->BindTexture(0, ginfo->pic0.texture->GetTexture());
texture = ginfo->pic0.texture->GetTexture();
}

uint32_t color = whiteAlpha(ease(progress)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(dc.GetBounds(), 0,0,1,1, color);
dc.Flush();
dc.RebindTexture();

if (texture) {
dc.GetDrawContext()->BindTexture(0, texture);
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
dc.Flush();
dc.RebindTexture();
}
return true;
}

0 comments on commit e51ea85

Please sign in to comment.
You can’t perform that action at this time.