[aseprite] 109/250: Don't reset mask color from doc::Image in Sprite Size and Rotate Sprite commands (fix #820)

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 1c1a55b2d36afd365345e2cfdfe505d8ab3ee971
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Sep 30 09:20:55 2015 -0300

    Don't reset mask color from doc::Image in Sprite Size and Rotate Sprite commands (fix #820)
---
 src/app/commands/cmd_rotate.cpp      | 3 ++-
 src/app/commands/cmd_sprite_size.cpp | 1 +
 src/app/document_api.cpp             | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/app/commands/cmd_rotate.cpp b/src/app/commands/cmd_rotate.cpp
index fe115ec..493cbf7 100644
--- a/src/app/commands/cmd_rotate.cpp
+++ b/src/app/commands/cmd_rotate.cpp
@@ -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);
       }
 
diff --git a/src/app/commands/cmd_sprite_size.cpp b/src/app/commands/cmd_sprite_size.cpp
index ead4052..1ed03e9 100644
--- a/src/app/commands/cmd_sprite_size.cpp
+++ b/src/app/commands/cmd_sprite_size.cpp
@@ -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(
diff --git a/src/app/document_api.cpp b/src/app/document_api.cpp
index 3d6cd65..0be9db2 100644
--- a/src/app/document_api.cpp
+++ b/src/app/document_api.cpp
@@ -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));
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list