pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src blitter.cxx,1.4,1.5 math.hxx,1.1,1.2


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src blitter.cxx,1.4,1.5 math.hxx,1.1,1.2
Date: 20 Jun 2002 15:43:46 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv20754

Modified Files:
        blitter.cxx math.hxx 
Log Message:
- added own version of min/max/mid

Index: blitter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/blitter.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- blitter.cxx 20 Jun 2002 15:41:28 -0000      1.4
+++ blitter.cxx 20 Jun 2002 15:43:44 -0000      1.5
@@ -205,8 +205,8 @@
   provider->lock();
   if (1) // slow
     {
-      for(int y = max(0, -y_pos); y < sheight && (y + y_pos) < theight ; y++) 
-       for(int x = max(0,-x_pos); x < swidth && (x + x_pos) < twidth; x++) 
+      for(int y = Math::max(0, -y_pos); y < sheight && (y + y_pos) < theight ; 
y++) 
+       for(int x = Math::max(0,-x_pos); x < swidth && (x + x_pos) < twidth; 
x++) 
          {
            provider->get_pixel(x, y, &red, &green, &blue, &alpha);
            canvas->get_pixel(x + x_pos, y + y_pos, &tred, &tgreen, &tblue, 
&talpha);

Index: math.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/math.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- math.hxx    20 Jun 2002 15:20:25 -0000      1.1
+++ math.hxx    20 Jun 2002 15:43:44 -0000      1.2
@@ -24,7 +24,7 @@
 {
   namespace Math
   {
-    template<class C> 
+    template<class T> 
     T min (const T& a, const T& b) 
     {
       if (a < b)
@@ -40,6 +40,12 @@
        return a;
       else
        return b;
+    }
+
+    template<class T> 
+    T mid (const T& a, const T& b, const T& c) 
+    {
+      return max((a), min((b), (c)));
     }
   }
 }




reply via email to

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