Commit 6fb3752b authored by dscho's avatar dscho

test Floyd-Steinberg dither for alpha masks

parent 6273f206
...@@ -236,6 +236,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode) ...@@ -236,6 +236,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
{ {
int i,j; int i,j;
rfbCursorPtr c = screen->cursor; rfbCursorPtr c = screen->cursor;
int maskStride=(c->width+7)/8;
if(!c) if(!c)
return; return;
...@@ -252,10 +253,14 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode) ...@@ -252,10 +253,14 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
for(j=0;j<c->height;j++) for(j=0;j<c->height;j++)
for(i=0;i<c->width;i++) { for(i=0;i<c->width;i++) {
unsigned char value=0x100*j/c->height; unsigned char value=0x100*i/c->width;
rfbBool masked=(c->mask[(i/8)+(c->width+7)/8*j]<<(i&7))&0x80; rfbBool masked=(c->mask[(i/8)+maskStride*j]<<(i&7))&0x80;
c->alphaSource[i+c->width*j]=(masked?(mode==1?value:0xff-value):0); c->alphaSource[i+c->width*j]=(masked?(mode==1?value:0xff-value):0);
} }
if(c->cleanupMask)
free(c->mask);
c->mask=rfbMakeMaskFromAlphaSource(c->width,c->height,c->alphaSource);
c->cleanupMask=TRUE;
} }
/* Here the pointer events are handled */ /* Here the pointer events are handled */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment