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_impl.hxx,1.6,1.7


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src blitter_impl.hxx,1.6,1.7
Date: 2 Apr 2003 20:37:49 -0000

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv15803

Modified Files:
        blitter_impl.hxx 
Log Message:
out of bounce fix, maybe

Index: blitter_impl.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/blitter_impl.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- blitter_impl.hxx    25 Mar 2003 00:37:44 -0000      1.6
+++ blitter_impl.hxx    2 Apr 2003 20:37:47 -0000       1.7
@@ -54,7 +54,7 @@
 struct transform_rot180
 {
   static inline int get_index(int width, int height, int x, int y) {
-    return (width * height) - (y * width + x);
+    return (width * height) - (y * width + x) - 1;
   }
 
   static inline int get_x(int width, int height, int x, int y) { 
UNUSED_ARG(height); UNUSED_ARG(y);
@@ -187,7 +187,7 @@
 
   if (prov->is_indexed())
     {
-      //std::cout << "Using indexed blitter" << std::endl;
+      std::cout << "Using indexed blitter" << std::endl;
 
       IndexedCanvas* canvas = new IndexedCanvas(TransF::get_width (pwidth, 
pheight),
                                                 TransF::get_height(pwidth, 
pheight));
@@ -205,6 +205,22 @@
       for (int y = 0; y < pheight; ++y)
         for (int x = 0; x < pwidth; ++x)
           {
+// start: bounce check
+            int i = TransF::get_index(pwidth, pheight, x, y);
+            if (i < 0 || i >= pwidth * pheight)
+              {
+                std::cout << "Target: Out of bounce: " << i << " " << pwidth 
<< "x" << pheight
+                          << " " <<  typeid(TransF()).name() << std::endl;
+              }
+            
+            if (y * pwidth + x < 0
+                || y * pwidth + x >= pwidth * pheight)
+              {
+                std::cout << "Source: Out of bounce: " << i << " " << pwidth 
<< "x" << pheight
+                          << " " <<  typeid(TransF()).name() << std::endl;
+              }
+// end: bounce check
+
             target_buf[TransF::get_index(pwidth, pheight, x, y)] = 
source_buf[y * pwidth + x];
           }
 





reply via email to

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