[Swfed-svn] swfed-svn [109] GIF から抽出したパレットを利用するように修正 ( ゴミデータを見てました )

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 10日 (火) 10:31:36 JST


Revision: 109
          http://svn.sourceforge.jp/view?root=swfed&view=rev&rev=109
Author:   yoya
Date:     2009-02-10 10:31:36 +0900 (Tue, 10 Feb 2009)

Log Message:
-----------
GIF から抽出したパレットを利用するように修正 (ゴミデータを見てました)

Modified Paths:
--------------
    trunk/src/swf_gif.c


-------------- next part --------------
Modified: trunk/src/swf_gif.c
===================================================================
--- trunk/src/swf_gif.c	2009-02-09 22:57:44 UTC (rev 108)
+++ trunk/src/swf_gif.c	2009-02-10 01:31:36 UTC (rev 109)
@@ -142,6 +142,7 @@
     gif_height = GifFile->SHeight;
     bpp = ColorMap->BitsPerPixel;
     trans_index = getTransparentIndex(Image);
+    palette_num = ColorMap->ColorCount;
 
     *width  = (unsigned short) gif_width;
     *height = (unsigned short) gif_height;
@@ -165,21 +166,21 @@
      * image copy
      */
     int i;
-    *colormap_count = 256; // XXX
+    *colormap_count = palette_num;
     if (trans_index == -1) {  // Lossless
         swf_rgb_t *result_colormap = malloc(sizeof(swf_rgb_t) * palette_num);
         for (i=0 ; i < palette_num ; i++) {
-            result_colormap[i].red   = palette[i].red;
-            result_colormap[i].green = palette[i].green;
-            result_colormap[i].blue  = palette[i].blue;
+            result_colormap[i].red   = ColorMap->Colors[i].Red;
+            result_colormap[i].green = ColorMap->Colors[i].Green;
+            result_colormap[i].blue  = ColorMap->Colors[i].Blue;
         }
         *colormap = result_colormap;
     } else {  // Lossless2
         swf_rgba_t *result_colormap = malloc(sizeof(swf_rgba_t) * palette_num);  
         for (i=0 ; i < palette_num ; i++) {
-            result_colormap[i].red   = palette[i].red;
-            result_colormap[i].green = palette[i].green;
-            result_colormap[i].blue  = palette[i].blue;
+            result_colormap[i].red   = ColorMap->Colors[i].Red;
+            result_colormap[i].green = ColorMap->Colors[i].Green;
+            result_colormap[i].blue  = ColorMap->Colors[i].Blue;
             if (i == trans_index) {
                 result_colormap[i].alpha  = 0x0;
             } else {



Swfed-svn メーリングリストの案内
Zurück zum Archiv-Index