aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-11-23 16:12:17 +0100
committerPierre Ossman <ossman@cendio.se>2018-11-23 16:12:17 +0100
commit6c38a0876824daf2bd86c60d37328cd79b48182a (patch)
tree6e78cdf8fa404481976e4408a11f19fbcd4c4623
parent1f44e85bf403bfe9dd7298d37ae490fb0fc27cd6 (diff)
downloadtigervnc-6c38a0876824daf2bd86c60d37328cd79b48182a.tar.gz
tigervnc-6c38a0876824daf2bd86c60d37328cd79b48182a.zip
Use larger integers for the cursor dithering
We need a larger range to handle the temporary overflow caused by the Floyd-Steinberg dithering.
-rw-r--r--common/rfb/Cursor.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/rfb/Cursor.cxx b/common/rfb/Cursor.cxx
index d0feaa55..d7b536de 100644
--- a/common/rfb/Cursor.cxx
+++ b/common/rfb/Cursor.cxx
@@ -76,7 +76,7 @@ static unsigned short srgb_to_lin(unsigned char srgb)
}
// Floyd-Steinberg dithering
-static void dither(int width, int height, rdr::U16* data)
+static void dither(int width, int height, rdr::S32* data)
{
for (int y = 0; y < height; y++) {
for (int x_ = 0; x_ < width; x_++) {
@@ -122,12 +122,12 @@ static void dither(int width, int height, rdr::U16* data)
rdr::U8* Cursor::getBitmap() const
{
// First step is converting to luminance
- rdr::U16Array luminance(width()*height());
- rdr::U16 *lum_ptr = luminance.buf;
+ rdr::S32Array luminance(width()*height());
+ rdr::S32 *lum_ptr = luminance.buf;
const rdr::U8 *data_ptr = data;
for (int y = 0; y < height(); y++) {
for (int x = 0; x < width(); x++) {
- rdr::U32 lum;
+ rdr::S32 lum;
// Use BT.709 coefficients for grayscale
lum = 0;
@@ -167,8 +167,8 @@ rdr::U8* Cursor::getBitmap() const
rdr::U8* Cursor::getMask() const
{
// First step is converting to integer array
- rdr::U16Array alpha(width()*height());
- rdr::U16 *alpha_ptr = alpha.buf;
+ rdr::S32Array alpha(width()*height());
+ rdr::S32 *alpha_ptr = alpha.buf;
const rdr::U8 *data_ptr = data;
for (int y = 0; y < height(); y++) {
for (int x = 0; x < width(); x++) {