From 494b7ae6538b698a67ab461f122c16c3229577d2 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 31 Jul 2018 17:31:24 +0200 Subject: [PATCH] Fix texture reload --- src/pixmap.cxx | 6 ++++-- src/pixmap.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pixmap.cxx b/src/pixmap.cxx index 69c2ea0..0401c6e 100644 --- a/src/pixmap.cxx +++ b/src/pixmap.cxx @@ -256,7 +256,7 @@ CPixmap::ReloadTargetTextures () } else if (!Cache ( tex.first, tex.second.file, tex.second.dimTotal, - tex.second.dimIcon)) + tex.second.dimIcon, Mode::FIX, tex.second.wideName)) return false; } @@ -296,6 +296,7 @@ CPixmap::Cache (size_t channel, Point totalDim) m_SDLTextureInfo[channel].dimIcon = Point{0, 0}; m_SDLTextureInfo[channel].dimTotal = totalDim; m_SDLTextureInfo[channel].file = ""; + m_SDLTextureInfo[channel].wideName = ""; return true; } @@ -354,6 +355,7 @@ CPixmap::Cache ( m_SDLTextureInfo[channel].dimIcon = iconDim; m_SDLTextureInfo[channel].dimTotal = totalDim; m_SDLTextureInfo[channel].file = pFilename; + m_SDLTextureInfo[channel].wideName = wideName; SDL_SetRenderTarget (g_renderer, m_SDLTextureInfo[channel].texture); @@ -365,7 +367,7 @@ CPixmap::Cache ( { if (!wideName.empty ()) { - std::string file = GetBaseDir () + wideName; + std::string file = GetBaseDir () + m_SDLTextureInfo[channel].wideName; SDL_Surface * surface = IMG_Load (file.c_str ()); SDL_Texture * texture = SDL_CreateTextureFromSurface (g_renderer, surface); diff --git a/src/pixmap.h b/src/pixmap.h index 9e1afcb..7544cb5 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -34,6 +34,7 @@ struct TextureInfo { SDL_Texture * texture; bool target; // can be used as a render target std::string file; + std::string wideName; Point dimTotal; Point dimIcon;