Pārlūkot izejas kodu

Fix calculation of conversion test target values

Bit shifting gives an approximate, but not properly accurate value
when upconverting. Do a proper calculation.
tags/v1.8.90
Pierre Ossman pirms 6 gadiem
vecāks
revīzija
e6810fa3e5
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3
    3
      tests/conv.cxx

+ 3
- 3
tests/conv.cxx Parādīt failu

@@ -72,9 +72,9 @@ bool verifyPixel(const rfb::PixelFormat &dstpf,
g = (p >> dstpf.greenShift) & dstpf.greenMax;
b = (p >> dstpf.blueShift) & dstpf.blueMax;

r <<= 8 - dstpf.redBits;
g <<= 8 - dstpf.greenBits;
b <<= 8 - dstpf.blueBits;
r = (r * 255 + dstpf.redMax/2) / dstpf.redMax;
g = (g * 255 + dstpf.greenMax/2) / dstpf.greenMax;
b = (b * 255 + dstpf.blueMax/2) / dstpf.blueMax;

// The allowed error depends on:
//

Notiek ielāde…
Atcelt
Saglabāt