Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs!

This commit is contained in:
Alex Szpakowski
2014-08-07 14:53:17 -03:00
parent a0fff798aa
commit d59c76a55f
38 changed files with 194 additions and 247 deletions
+2 -9
View File
@@ -88,14 +88,10 @@ SpriteBatch::SpriteBatch(Texture *texture, int size, int usage)
delete element_buf;
throw love::Exception("Out of memory.");
}
texture->retain();
}
SpriteBatch::~SpriteBatch()
{
texture->release();
delete color;
delete array_buf;
delete element_buf;
@@ -172,15 +168,12 @@ void SpriteBatch::flush()
void SpriteBatch::setTexture(Texture *newtexture)
{
Object::AutoRelease imagerelease(texture);
newtexture->retain();
texture = newtexture;
texture.set(newtexture);
}
Texture *SpriteBatch::getTexture()
{
return texture;
return texture.get();
}
void SpriteBatch::setColor(const Color &color)