PDA

View Full Version : Possible bug in QVNCServer::pixelConversionNeeded



wawanbreton
12th July 2011, 15:47
Hi,

Watching the VNC server part of Qt Embedded, I just read the method pixelConversionNeeded, and the behaviour seems very strange to me. After checking whether the server and client endiannesses are the same (which logically returns true in case they are different), they check whether the pixels depths are the same, and if they are, a final check is done to ensure that every of the 3 primary colours have the same number of bits :



switch (screendepth) {
case 32:
case 24:
return false;
case 18:
return (pixelFormat.redBits == 6
&& pixelFormat.greenBits == 6
&& pixelFormat.blueBits == 6);
case 16:
return (pixelFormat.redBits == 5
&& pixelFormat.greenBits == 6
&& pixelFormat.blueBits == 5);
case 15:
return (pixelFormat.redBits == 5
&& pixelFormat.greenBits == 5
&& pixelFormat.blueBits == 5);
case 12:
return (pixelFormat.redBits == 4
&& pixelFormat.greenBits == 4
&& pixelFormat.blueBits == 4);
}


For example, in my case, the screen depth is 16, and my colours are 5-6-5, which is the common case. However, according to this test, the function returns true, and my pixels are converted before they are sent, which is useless. I tried modifying the test to be the following :



switch (screendepth) {
case 32:
case 24:
return false;
case 18:
return (pixelFormat.redBits != 6
|| pixelFormat.greenBits != 6
|| pixelFormat.blueBits != 6);
case 16:
return (pixelFormat.redBits != 5
|| pixelFormat.greenBits != 6
|| pixelFormat.blueBits != 5);
case 15:
return (pixelFormat.redBits != 5
|| pixelFormat.greenBits != 5
|| pixelFormat.blueBits != 5);
case 12:
return (pixelFormat.redBits != 4
|| pixelFormat.greenBits != 4
|| pixelFormat.blueBits != 4);
}


This code just says that a pixel conversion is needed in case any of the bits for each colour is different, which is more logical to me. I tried to compile this code, and it actually works, so does someone else share my feeling that I should post a bug to Qt ?

Thanks for reading !