stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/video png.c


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src/video png.c
Date: Fri, 21 Nov 2003 00:34:57 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Nehal Mistry <address@hidden>   03/11/21 00:34:57

Modified files:
        src/video      : png.c 

Log message:
        use index 255 for transparency color

Patches:
Index: stratagus/src/video/png.c
diff -u stratagus/src/video/png.c:1.26 stratagus/src/video/png.c:1.27
--- stratagus/src/video/png.c:1.26      Mon Nov 17 20:50:15 2003
+++ stratagus/src/video/png.c   Fri Nov 21 00:34:56 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: png.c,v 1.26 2003/11/18 01:50:15 nehalmistry Exp $
+//     $Id: png.c,v 1.27 2003/11/21 05:34:56 nehalmistry Exp $
 
 //@{
 
@@ -133,44 +133,8 @@
        info_ptr->width * info_ptr->height);
     DebugLevel3("%s: %s" _C_ name _C_
        png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE) ? "palette" : "");
-#ifdef USE_SDL_SURFACE
-
-    // FIXME: need to get the correct color
-    /*
-    if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
-       Exit(-1);
-       Uint8 *trans;
-       int num_trans;
-
-       int t = -1;
-       png_color_16 *transv;
-       png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &transv);
-       printf("num_trans = %d\n", num_trans);
-           for (i = 0; i < num_trans; ++i) {
-               if(trans[i] == 0) {
-                   if (t >= 0) {
-                       break;
-                   }
-                   t = i;
-               } else if (trans[i] != 255) {
-                   break;
-               }
-           }
-           if (i == num_trans) {
-               // exactly one transparent index
-               ckey = t;
-           } else {
-               // more than one transparent index, or translucency
-               png_set_expand(png_ptr);
-           }
-
-    }
-*/
-#else
     DebugLevel3(" %s" _C_
        png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ? "transparent" : "");
-#endif
-
     DebugLevel3(" depth %d\n" _C_ info_ptr->bit_depth);
 
     // Setup translators:
@@ -270,15 +234,9 @@
     graphic = MakeGraphic(8, w, h, data, w * h);       // data freed by make 
graphic
 #ifdef USE_SDL_SURFACE
     SDL_SetPalette(graphic->Surface, SDL_LOGPAL|SDL_PHYSPAL, palettecolors, 0, 
256);
-//    SDL_SetColorKey(graphic->Surface, SDL_SRCCOLORKEY|SDL_RLEACCEL, ckey);
-
-    // FIXME: need to find correct color
     SDL_SetColorKey(graphic->Surface, SDL_SRCCOLORKEY|SDL_RLEACCEL, 
-       SDL_MapRGB(graphic->Surface->format, 255, 255, 255));
-
-//     SDL_MapRGB(graphic->Surface->format, 255, 255, 255));
-//    SDL_SetPalette(graphic->Surface, 0, palettecolors, 0, 256);
-//    SDL_SetPalette(TheScreen, SDL_LOGPAL|SDL_PHYSPAL, palettecolors, 0, 256);
+       SDL_MapRGB(graphic->Surface->format, palettecolors[255].r, 
+       palettecolors[255].g, palettecolors[255].b));
 #else
     graphic->Palette = palette;  //FIXME: should this be part of MakeGraphic
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]