Browse Source

Fix bad color of cursor with x0vncserver

We cannot assume endian-ness for the cursor we get from XFixes.
Adjust the algorithm to properly follow the specification.
tags/v1.9.90
Pierre Ossman 5 years ago
parent
commit
6d0a5a267b
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      unix/x0vncserver/XDesktop.cxx

+ 5
- 6
unix/x0vncserver/XDesktop.cxx View File

@@ -708,16 +708,15 @@ bool XDesktop::setCursor()
for (int x = 0; x < cim->width; x++) {
rdr::U8 alpha;
rdr::U32 pixel = *pixels++;
rdr::U8 *in = (rdr::U8 *) &pixel;

alpha = in[3];
alpha = (pixel >> 24) & 0xff;
if (alpha == 0)
alpha = 1; // Avoid division by zero

*out++ = (unsigned)*in++ * 255/alpha;
*out++ = (unsigned)*in++ * 255/alpha;
*out++ = (unsigned)*in++ * 255/alpha;
*out++ = *in++;
*out++ = ((pixel >> 16) & 0xff) * 255/alpha;
*out++ = ((pixel >> 8) & 0xff) * 255/alpha;
*out++ = ((pixel >> 0) & 0xff) * 255/alpha;
*out++ = ((pixel >> 24) & 0xff);
}
}


Loading…
Cancel
Save