Fixed bug in AddImage() method on a frame, to copy the image instead of just pointing to it. This fixed many issues in the FrameMapper as well, which copies images alot.

This commit is contained in:
Jonathan Thomas
2013-11-04 15:16:19 -06:00
parent 1bdea062d6
commit 1e7cd7ddbb
4 changed files with 30 additions and 49 deletions

View File

@@ -512,7 +512,7 @@ void Frame::AddImage(int width, int height, const string map, const Magick::Stor
void Frame::AddImage(tr1::shared_ptr<Magick::Image> new_image)
{
// assign image data
image = new_image;
image = tr1::shared_ptr<Magick::Image>(new Magick::Image(*new_image.get()));
// Update height and width
width = image->columns();
@@ -524,7 +524,7 @@ void Frame::AddImage(tr1::shared_ptr<Magick::Image> new_image, bool only_odd_lin
{
// Replace image (if needed)
if (image->columns() == 1)
image = new_image;
image = tr1::shared_ptr<Magick::Image>(new Magick::Image(*new_image.get()));
// Loop through each odd or even line, and copy it to the image
int starting_row = 0;
@@ -557,7 +557,7 @@ void Frame::AddImage(tr1::shared_ptr<Magick::Image> new_image, float alpha)
{
// Replace image (if needed)
if (image->columns() == 1)
image = new_image;
image = tr1::shared_ptr<Magick::Image>(new Magick::Image(*new_image.get()));
else
{
// Calculate opacity of new image