Skip to content

Commit

Permalink
Android: No longer keep an active input stream longer than needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioLiebisch committed Mar 20, 2018
1 parent bc16629 commit 4cd36b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
3 changes: 0 additions & 3 deletions include/SFML/Graphics/Image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ class SFML_GRAPHICS_API Image
////////////////////////////////////////////////////////////
Vector2u m_size; ///< Image size
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
Expand Down
16 changes: 2 additions & 14 deletions src/SFML/Graphics/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,14 @@ namespace sf
Image::Image() :
m_size(0, 0)
{
#ifdef SFML_SYSTEM_ANDROID

m_stream = NULL;

#endif
}


////////////////////////////////////////////////////////////
Image::~Image()
{
#ifdef SFML_SYSTEM_ANDROID

if (m_stream)
delete (priv::ResourceStream*)m_stream;

#endif
}


Expand Down Expand Up @@ -135,11 +126,8 @@ bool Image::loadFromFile(const std::string& filename)

#else

if (m_stream)
delete (priv::ResourceStream*)m_stream;

m_stream = new priv::ResourceStream(filename);
return loadFromStream(*(priv::ResourceStream*)m_stream);
priv::ResourceStream stream(filename);
return loadFromStream(stream);

#endif
}
Expand Down

0 comments on commit 4cd36b7

Please sign in to comment.