]> git.cworth.org Git - apitrace/commitdiff
Ignore alpha channel.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 8 Feb 2011 16:23:56 +0000 (16:23 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 8 Feb 2011 16:24:58 +0000 (16:24 +0000)
Until we are able to pick a visual that matches the traces.

TODO
image.cpp

diff --git a/TODO b/TODO
index 0a516f031233be531fd9171c977a2a9dec5c19b1..fe722dd84beb22f8626c2abb7f53a35e8bc097a3 100644 (file)
--- a/TODO
+++ b/TODO
@@ -13,6 +13,8 @@
 
 * Allow clamping to a GL version or a number of extensions.
 
+* Match the traced visuals (which will imply abandoning GLUT)
+
 * Trace multiple threads
   * GetCurrentThreadId()
   * pthread_self()
index 9fd1dc8096992e78c651609c1e58d68d68200d19..a42a78d3319c9feaf83e68ea690ed3cfb71300f0 100644 (file)
--- a/image.cpp
+++ b/image.cpp
@@ -286,9 +286,13 @@ double Image::compare(Image &ref)
 
     unsigned long long error = 0;
     for (unsigned y = 0; y < height; ++y) {
-        for (unsigned  x = 0; x < width*4; ++x) {
-            int delta = pSrc[x] - pRef[x];
-            error += delta*delta;
+        for (unsigned  x = 0; x < width; ++x) {
+            // FIXME: Ignore alpha channel until we are able to pick a visual
+            // that matches the traces
+            for (unsigned  c = 0; c < 3; ++c) {
+                int delta = pSrc[x*4 + c] - pRef[x*4 + c];
+                error += delta*delta;
+            }
         }
 
         pSrc += stride();
@@ -296,7 +300,7 @@ double Image::compare(Image &ref)
     }
 
     double numerator = error*2 + 1;
-    double denominator = height*width*4ULL*255ULL*255ULL*2;
+    double denominator = height*width*3ULL*255ULL*255ULL*2;
     double quotient = numerator/denominator;
 
     // Precision in bits