Small optimization when opening the menu.

This commit is contained in:
Leon Styhre 2021-11-07 19:21:01 +01:00
parent 14e1b800fa
commit c136f87a9f
2 changed files with 12 additions and 3 deletions

View file

@ -128,6 +128,10 @@ bool Window::init()
mBackgroundOverlay->setResize(static_cast<float>(Renderer::getScreenWidth()), mBackgroundOverlay->setResize(static_cast<float>(Renderer::getScreenWidth()),
static_cast<float>(Renderer::getScreenHeight())); static_cast<float>(Renderer::getScreenHeight()));
#if defined(USE_OPENGL_21)
mPostprocessedBackground = TextureResource::get("");
#endif
mListScrollFont = Font::get(FONT_SIZE_LARGE); mListScrollFont = Font::get(FONT_SIZE_LARGE);
// Update our help because font sizes probably changed. // Update our help because font sizes probably changed.
@ -143,6 +147,10 @@ void Window::deinit()
for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++) for (auto it = mGuiStack.cbegin(); it != mGuiStack.cend(); it++)
(*it)->onHide(); (*it)->onHide();
#if defined(USE_OPENGL_21)
mPostprocessedBackground.reset();
#endif
InputManager::getInstance()->deinit(); InputManager::getInstance()->deinit();
ResourceManager::getInstance()->unloadAll(); ResourceManager::getInstance()->unloadAll();
#if defined(BUILD_VLC_PLAYER) #if defined(BUILD_VLC_PLAYER)
@ -429,9 +437,6 @@ void Window::render()
#if (CLOCK_BACKGROUND_CREATION) #if (CLOCK_BACKGROUND_CREATION)
const auto backgroundStartTime = std::chrono::system_clock::now(); const auto backgroundStartTime = std::chrono::system_clock::now();
#endif #endif
std::shared_ptr<TextureResource> mPostprocessedBackground;
mPostprocessedBackground = TextureResource::get("");
unsigned char* processedTexture = unsigned char* processedTexture =
new unsigned char[Renderer::getScreenWidth() * Renderer::getScreenHeight() * 4]; new unsigned char[Renderer::getScreenWidth() * Renderer::getScreenHeight() * 4];

View file

@ -167,6 +167,10 @@ private:
std::queue<std::pair<std::string, int>> mInfoPopupQueue; std::queue<std::pair<std::string, int>> mInfoPopupQueue;
#if defined(USE_OPENGL_21)
std::shared_ptr<TextureResource> mPostprocessedBackground;
#endif
std::string mListScrollText; std::string mListScrollText;
std::shared_ptr<Font> mListScrollFont; std::shared_ptr<Font> mListScrollFont;
unsigned char mListScrollOpacity; unsigned char mListScrollOpacity;