Fixed the sf::Font texture corruption bug for big character sizes

This commit is contained in:
Laurent Gomila 2012-10-26 16:49:46 +02:00
parent 109d914bcb
commit 49f37ee8b3

View File

@ -521,9 +521,10 @@ IntRect Font::findGlyphRect(Page& page, unsigned int width, unsigned int height)
if ((textureWidth * 2 <= Texture::getMaximumSize()) && (textureHeight * 2 <= Texture::getMaximumSize())) if ((textureWidth * 2 <= Texture::getMaximumSize()) && (textureHeight * 2 <= Texture::getMaximumSize()))
{ {
// Make the texture 2 times bigger // Make the texture 2 times bigger
sf::Image pixels = page.texture.copyToImage(); Image newImage;
page.texture.create(textureWidth * 2, textureHeight * 2); newImage.create(textureWidth * 2, textureHeight * 2, Color(255, 255, 255, 0));
page.texture.update(pixels); newImage.copy(page.texture.copyToImage(), 0, 0);
page.texture.loadFromImage(newImage);
} }
else else
{ {