stratagus-cvs
[Top][All Lists]
Advanced

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

[Stratagus-CVS] stratagus/src/map map_fog.c


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src/map map_fog.c
Date: Sun, 30 Nov 2003 15:34:47 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Nehal Mistry <address@hidden>   03/11/30 15:34:47

Modified files:
        src/map        : map_fog.c 

Log message:
        fix saturation

Patches:
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.126 stratagus/src/map/map_fog.c:1.127
--- stratagus/src/map/map_fog.c:1.126   Sun Nov 30 15:06:54 2003
+++ stratagus/src/map/map_fog.c Sun Nov 30 15:34:47 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: map_fog.c,v 1.126 2003/11/30 20:06:54 nehalmistry Exp $
+//     $Id: map_fog.c,v 1.127 2003/11/30 20:34:47 nehalmistry Exp $
 
 //@{
 
@@ -573,13 +573,7 @@
            if (*p) {
                SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
                // Saturation + Brightness
-               if (cdest.r > cdest.g && cdest.r > cdest.b) {
-                   max = cdest.r;
-               } else if (cdest.g > cdest.b) {
-                   max = cdest.g;
-               } else {
-                   max = cdest.b;
-               }
+               max = (cdest.r + cdest.g + cdest.b) / 3;
                v = cdest.r + bright;
                cdest.r = (v > 255 ? 255 : v) + (max - cdest.r) * sat / 100;
                v = cdest.g + bright;
@@ -666,13 +660,7 @@
            if (!(cdest.r | cdest.g | cdest.b) && *p) {
                SDL_GetRGB(*p, TheScreen->format, &cdest.r, &cdest.g, &cdest.b);
                // Saturation + Brightness
-               if (cdest.r > cdest.g && cdest.r > cdest.b) {
-                   max = cdest.r;
-               } else if (cdest.g > cdest.b) {
-                   max = cdest.g;
-               } else {
-                   max = cdest.b;
-               }
+               max = (cdest.r + cdest.g + cdest.b) / 3;
                v = cdest.r + bright;
                cdest.r = (v > 255 ? 255 : v) + (max - cdest.r) * sat / 100;
                v = cdest.g + bright;




reply via email to

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