[aseprite] 241/308: Fix shading ink for sprites with more than 256 colors

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:15 UTC 2016


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

thansen pushed a commit to branch master
in repository aseprite.

commit fd71ceb4c93976be7517b47f33cb506aa200ee02
Author: David Capello <davidcapello at gmail.com>
Date:   Tue Feb 16 17:11:30 2016 -0300

    Fix shading ink for sprites with more than 256 colors
    
    When the shading ink is used on RGBA sprites, we can have color palettes
    with more than 256 colors. In this way the shade will contain entries
    with indexes >= 256.
---
 src/app/tools/ink_processing.h | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/app/tools/ink_processing.h b/src/app/tools/ink_processing.h
index 3add6b0..5580d00 100644
--- a/src/app/tools/ink_processing.h
+++ b/src/app/tools/ink_processing.h
@@ -724,13 +724,19 @@ public:
 
   void processPixel(int x, int y) {
     color_t src = *m_srcAddress;
-    int i = m_rgbmap->mapColor(rgba_getr(src),
-                               rgba_getg(src),
-                               rgba_getb(src),
-                               rgba_geta(src));
 
-    // The color must be an exact match
-    if (src != m_palette->getEntry(i)) {
+    // We cannot use the m_rgbmap->mapColor() function because RgbMaps
+    // are created with findBestfit(), and findBestfit() limits the
+    // returned indexes to [0,255] range (it's mainly used for RGBA ->
+    // Indexed image conversion).
+    int i = m_palette->findExactMatch(rgba_getr(src),
+                                      rgba_getg(src),
+                                      rgba_getb(src),
+                                      rgba_geta(src),
+                                      -1);
+
+    // If we didn't find the exact match.
+    if (i < 0) {
       *m_dstAddress = src;
       return;
     }

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