[Android] Fixed memory leak when loading asset files

This commit is contained in:
Jonathan De Wachter 2013-11-17 05:31:40 +01:00
parent 891cd261b8
commit 634c3dc2a7
9 changed files with 275 additions and 109 deletions

View file

@ -305,6 +305,9 @@ private :
Info m_info; ///< Information about the font
mutable PageTable m_pages; ///< Table containing the glyphs pages by character size
mutable std::vector<Uint8> m_pixelBuffer; ///< Pixel buffer holding a glyph's pixels before being written to the texture
#ifdef SFML_SYSTEM_ANDROID
void* m_stream; ///< Asset file streamer (if loaded from file)
#endif
};
} // namespace sf
@ -351,19 +354,19 @@ private :
/// \code
/// // Declare a new font
/// sf::Font font;
///
///
/// // Load it from a file
/// if (!font.loadFromFile("arial.ttf"))
/// {
/// // error...
/// }
///
///
/// // Create a text which uses our font
/// sf::Text text1;
/// text1.setFont(font);
/// text1.setCharacterSize(30);
/// text1.setStyle(sf::Text::Regular);
///
///
/// // Create another text using the same font, but with different parameters
/// sf::Text text2;
/// text2.setFont(font);

View file

@ -55,6 +55,12 @@ public :
////////////////////////////////////////////////////////////
Image();
////////////////////////////////////////////////////////////
/// \brief Destructor
///
////////////////////////////////////////////////////////////
~Image();
////////////////////////////////////////////////////////////
/// \brief Create the image and fill it with a unique color
///
@ -259,6 +265,9 @@ private :
////////////////////////////////////////////////////////////
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