<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - test/cairo-test-suite reports wrong max diff comparing different opaque images"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=84044#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - test/cairo-test-suite reports wrong max diff comparing different opaque images"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=84044">bug 84044</a>
              from <span class="vcard"><a class="email" href="mailto:psychon@znc.in" title="Uli Schlachter <psychon@znc.in>"> <span class="fn">Uli Schlachter</span></a>
</span></b>
        <pre>(In reply to Massimo from <a href="show_bug.cgi?id=84044#c3">comment #3</a>)
<span class="quote">> (In reply to Uli Schlachter from <a href="show_bug.cgi?id=84044#c2">comment #2</a>)
> > Isn't the bug here really in the code that compares the images?
> > 
> > You are blaming test/buffer-diff.c line 80 which is:
> > 
> >    if ((row_a[x] & mask) != (row_b[x] & mask))
> > 

> I blamed test/buffer-diff.c because when that condition is
> TRUE, the maximum diff computed includes also the non-alpha
> channel:

> <a href="http://cgit.freedesktop.org/cairo/tree/test/buffer-diff.c#n85">http://cgit.freedesktop.org/cairo/tree/test/buffer-diff.c#n85</a>

> So my first observation was reading a test log in which
> two identical images (argb32 and rgb24) had reported two
> max diff values compared to the same reference.</span >

Ah, I missed that part. From a quick look, I'd fix that by changing these two
lines:

            int value_a = (row_a[x] >> (channel*8)) & 0xff;
            int value_b = (row_b[x] >> (channel*8)) & 0xff;

into

            int value_a = ((row_a[x] & mask) >> (channel*8)) & 0xff;

Oh and line 101 needs to be changed as well, something like "&& mask !=
0x00ffffff". Here it seems simpler to pass a cairo_format_t or cairo_bool_t
into buffer_diff_core() and calculate the mask based on that.

<span class="quote">> yes, there are also other bugs in test/pdiff</span >

I'd rather fix these problems in pdiff instead of somewhere in the code
producing these images. In theory, these two code paths are independent from
each other and pdiff could be used from something else than just the test
suite.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>