Fix custom UI backgrounds again by initializing lazily (turned out to be the cause of #10662)

This commit is contained in:
Henrik Rydgård 2018-03-01 16:08:23 +01:00
parent 1e940f4973
commit 18db8b0bd6
2 changed files with 8 additions and 2 deletions

View File

@ -71,6 +71,8 @@ static const uint32_t colors[4] = {
static std::unique_ptr<ManagedTexture> bgTexture;
static bool backgroundInited;
void UIBackgroundInit(UIContext &dc) {
const std::string bgPng = GetSysDirectory(DIRECTORY_SYSTEM) + "background.png";
const std::string bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) + "background.jpg";
@ -82,9 +84,15 @@ void UIBackgroundInit(UIContext &dc) {
void UIBackgroundShutdown() {
bgTexture.reset(nullptr);
backgroundInited = false;
}
void DrawBackground(UIContext &dc, float alpha) {
if (!backgroundInited) {
UIBackgroundInit(dc);
backgroundInited = true;
}
static float xbase[100] = {0};
static float ybase[100] = {0};
float xres = dc.GetBounds().w;

View File

@ -664,8 +664,6 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
screenManager->setDrawContext(g_draw);
screenManager->setPostRenderCallback(&RenderOverlays, nullptr);
UIBackgroundInit(*uiContext);
#ifdef _WIN32
winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend);
#if PPSSPP_PLATFORM(UWP)