Don't reset mask color from doc::Image in Sprite Size and Rotate Sprite commands (fix #820)

This commit is contained in:
David Capello 2015-09-30 09:20:55 -03:00
parent 30b257a8f5
commit 1c1a55b2d3
3 changed files with 7 additions and 1 deletions

View File

@ -98,8 +98,9 @@ protected:
ImageRef new_image(Image::create(image->pixelFormat(),
m_angle == 180 ? image->width(): image->height(),
m_angle == 180 ? image->height(): image->width()));
doc::rotate_image(image, new_image.get(), m_angle);
new_image->setMaskColor(image->maskColor());
doc::rotate_image(image, new_image.get(), m_angle);
api.replaceImage(m_sprite, cel->imageRef(), new_image);
}

View File

@ -94,6 +94,7 @@ protected:
int w = scale_x(image->width());
int h = scale_y(image->height());
ImageRef new_image(Image::create(image->pixelFormat(), MAX(1, w), MAX(1, h)));
new_image->setMaskColor(image->maskColor());
doc::algorithm::fixup_image_transparent_colors(image);
doc::algorithm::resize_image(

View File

@ -489,6 +489,10 @@ Cel* DocumentApi::addCel(LayerImage* layer, frame_t frameNumber, const ImageRef&
void DocumentApi::replaceImage(Sprite* sprite, const ImageRef& oldImage, const ImageRef& newImage)
{
ASSERT(oldImage);
ASSERT(newImage);
ASSERT(oldImage->maskColor() == newImage->maskColor());
m_transaction.execute(new cmd::ReplaceImage(
sprite, oldImage, newImage));
}