[aseprite] 231/250: Fix Edit > Insert Text command for non-RGB sprites

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:34 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 41e920391817bf29b8fe986c61ba23af49cb48a2
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Nov 4 11:26:58 2015 -0300

    Fix Edit > Insert Text command for non-RGB sprites
---
 src/app/commands/cmd_paste_text.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/app/commands/cmd_paste_text.cpp b/src/app/commands/cmd_paste_text.cpp
index e2127d4..c08e74a 100644
--- a/src/app/commands/cmd_paste_text.cpp
+++ b/src/app/commands/cmd_paste_text.cpp
@@ -26,6 +26,7 @@
 #include "base/unique_ptr.h"
 #include "doc/image.h"
 #include "doc/image_ref.h"
+#include "render/quantization.h"
 
 #include "paste_text.xml.h"
 
@@ -173,6 +174,16 @@ void PasteTextCommand::onExecute(Context* ctx)
 
     doc::ImageRef image(render_text(faceName, size, text, color));
     if (image) {
+      Sprite* sprite = editor->sprite();
+      if (image->pixelFormat() != sprite->pixelFormat()) {
+        RgbMap* rgbmap = sprite->rgbMap(editor->frame());
+        image.reset(
+          render::convert_pixel_format(
+            image.get(), NULL, sprite->pixelFormat(),
+            DitheringMethod::NONE, rgbmap, sprite->palette(editor->frame()),
+            false, 0));
+      }
+
       editor->pasteImage(image.get());
     }
   }

-- 
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