[aseprite] 86/250: Add colormap2rgba() helper function in gif_format.cpp

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:15 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 8db66931362c38f9ad2d27ab4330392ac33874c6
Author: David Capello <davidcapello at gmail.com>
Date:   Thu Sep 24 23:45:10 2015 -0300

    Add colormap2rgba() helper function in gif_format.cpp
---
 src/app/file/gif_format.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/app/file/gif_format.cpp b/src/app/file/gif_format.cpp
index da1834d..e637405 100644
--- a/src/app/file/gif_format.cpp
+++ b/src/app/file/gif_format.cpp
@@ -155,6 +155,13 @@ static void process_disposal_method(const Image* previous,
   }
 }
 
+static inline doc::color_t colormap2rgba(ColorMapObject* colormap, int i) {
+  return doc::rgba(
+    colormap->Colors[i].Red,
+    colormap->Colors[i].Green,
+    colormap->Colors[i].Blue, 255);
+}
+
 // Decodes a GIF file trying to keep the image in Indexed format. If
 // it's not possible to handle it as Indexed (e.g. it contains more
 // than 256 colors), the file will be automatically converted to RGB.
@@ -511,6 +518,7 @@ private:
         continue;
 
       int j = -1;
+
       if (m_frameNum > 0) {
         j = oldPalette.findExactMatch(
           colormap->Colors[i].Red,
@@ -521,11 +529,7 @@ private:
 
       if (j < 0) {
         j = base++;
-        palette->setEntry(
-          j, rgba(
-            colormap->Colors[i].Red,
-            colormap->Colors[i].Green,
-            colormap->Colors[i].Blue, 255));
+        palette->setEntry(j, colormap2rgba(colormap, i));
       }
       m_remap.map(i, j);
     }
@@ -691,10 +695,7 @@ private:
     Palette newPalette(0, colormap->ColorCount);
 
     for (int i=0; i<colormap->ColorCount; ++i) {
-      newPalette.setEntry(
-        i, rgba(colormap->Colors[i].Red,
-                colormap->Colors[i].Green,
-                colormap->Colors[i].Blue, 255));
+      newPalette.setEntry(i, colormap2rgba(colormap, i));;
     }
 
     Remap remap = create_remap_to_change_palette(

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