Fixed a bug with the SDL YUV420p color conversion. Locally scoped Image was going out of scope, before I could get the colors completly out of it. Race condition.

This commit is contained in:
Jonathan Thomas
2011-10-11 23:20:26 -05:00
parent 161e8923af
commit 4646aea99f
3 changed files with 14 additions and 10 deletions

View File

@@ -139,15 +139,18 @@ const Magick::PixelPacket* Frame::GetPixels(int row)
const Magick::PixelPacket* Frame::GetPixels(unsigned int width, unsigned int height, int frame)
{
// Create a new resized image
Magick::Image newImage = *image;
newImage.resize(Magick::Geometry(width, height));
//Magick::Image newImage = *image;
small_image = new Magick::Image(*(image));
small_image->resize(Magick::Geometry(width, height));
small_image->colorize(255, 0, 0, Magick::Color(0,0,255));
small_image->blur(5.0, 5.0);
stringstream file;
file << "frame" << frame << ".png";
newImage.write(file.str());
small_image->write(file.str());
// Return arry of pixel packets
return newImage.getConstPixels(0,0, newImage.columns(), newImage.rows());
return small_image->getConstPixels(0,0, small_image->columns(), small_image->rows());
}
// Get height of image