diff --git a/src/event.cxx b/src/event.cxx index b95cf22..e20418d 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1640,6 +1640,8 @@ void CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) else SDL_RenderSetLogicalSize (g_renderer, LXIMAGE, LYIMAGE); + m_pPixmap->ReloadTargetTextures (); + /* Force this update before otherwise the coordinates retrieved with * the Warp SDL function are corresponding to the previous size. */ diff --git a/src/pixmap.cxx b/src/pixmap.cxx index 8882fa4..758ad69 100644 --- a/src/pixmap.cxx +++ b/src/pixmap.cxx @@ -171,9 +171,31 @@ Sint32 CPixmap::BltFast (SDL_Texture *lpSDL, size_t channel, POINT dst, return res; } +/** + * \brief Reload textures created with access target flag. + * + * \returns true on success. + */ +bool CPixmap::ReloadTargetTextures () +{ + for (auto &tex: m_SDLTextureInfo) + { + if (!tex.second.target) + continue; + + if (!Cache (tex.first, + tex.second.file, + tex.second.dimTotal, + tex.second.dimIcon)) + return false; + } + + return true; +} + // Cache une image contenant des ic�nes. -bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim, +bool CPixmap::Cache (size_t channel, const std::string &pFilename, POINT totalDim, POINT iconDim) { std::string file = GetBaseDir() + pFilename; @@ -230,7 +252,7 @@ bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim, // Cache une image globale. -bool CPixmap::Cache (size_t channel, const char *pFilename, POINT totalDim) +bool CPixmap::Cache (size_t channel, const std::string &pFilename, POINT totalDim) { POINT iconDim; diff --git a/src/pixmap.h b/src/pixmap.h index 2395600..50ecd88 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -32,9 +32,10 @@ public: bool Create (POINT dim, Sint32 mouseType); void Fill (RECT rect, COLORREF color); - bool Cache (size_t channel, const char *pFilename, POINT totalDim, + bool ReloadTargetTextures (); + bool Cache (size_t channel, const std::string &pFilename, POINT totalDim, POINT iconDim); - bool Cache (size_t channel, const char *pFilename, POINT totalDim); + bool Cache (size_t channel, const std::string &pFilename, POINT totalDim); bool Cache (size_t channel, SDL_Surface *surface, POINT totalDim); void SetClipping (RECT clip); RECT GetClipping();