Improved performance and reduced temporary memory usage of love.graphics.newScreenshot and Canvas:getImageData

This commit is contained in:
Alex Szpakowski
2013-06-15 22:07:16 -03:00
parent 15535517d6
commit f25efcc8af
7 changed files with 18 additions and 12 deletions
+6 -2
View File
@@ -45,11 +45,15 @@ ImageData::ImageData(int width, int height)
memset(data, 0, width*height*sizeof(pixel));
}
ImageData::ImageData(int width, int height, void *data)
ImageData::ImageData(int width, int height, void *data, bool own)
{
this->width = width;
this->height = height;
create(width, height, data);
if (own)
this->data = (unsigned char *) data;
else
create(width, height, data);
}
ImageData::~ImageData()