Android: No longer keep an active input stream longer than needed.

This commit is contained in:
Mario Liebisch 2018-03-20 09:33:06 +01:00 committed by Lukas Dürrenberger
parent 3a96024f6b
commit 1e800d9551
2 changed files with 2 additions and 17 deletions

View File

@ -265,9 +265,6 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2u m_size; ///< Image size Vector2u m_size; ///< Image size
std::vector<Uint8> m_pixels; ///< Pixels of the image std::vector<Uint8> m_pixels; ///< Pixels of the image
#ifdef SFML_SYSTEM_ANDROID
void* m_stream; ///< Asset file streamer (if loaded from file)
#endif
}; };
} // namespace sf } // namespace sf

View File

@ -41,23 +41,14 @@ namespace sf
Image::Image() : Image::Image() :
m_size(0, 0) m_size(0, 0)
{ {
#ifdef SFML_SYSTEM_ANDROID
m_stream = NULL;
#endif
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Image::~Image() Image::~Image()
{ {
#ifdef SFML_SYSTEM_ANDROID
if (m_stream)
delete (priv::ResourceStream*)m_stream;
#endif
} }
@ -135,11 +126,8 @@ bool Image::loadFromFile(const std::string& filename)
#else #else
if (m_stream) priv::ResourceStream stream(filename);
delete (priv::ResourceStream*)m_stream; return loadFromStream(stream);
m_stream = new priv::ResourceStream(filename);
return loadFromStream(*(priv::ResourceStream*)m_stream);
#endif #endif
} }