summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2005-01-23 18:05:44 +0000
committerdscho <dscho>2005-01-23 18:05:44 +0000
commit6fb3752bf23af0d2fc683986374e716a3eb88bb1 (patch)
treef767e23757781ef41ffc93c68703fdbb70852651
parent6273f2065a72261ba6cb3f6a070421033c96077d (diff)
downloadlibtdevnc-6fb3752b.tar.gz
libtdevnc-6fb3752b.zip
test Floyd-Steinberg dither for alpha masks
-rwxr-xr-xtest/cursortest.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/cursortest.c b/test/cursortest.c
index 195fc60..8e98aed 100755
--- a/test/cursortest.c
+++ b/test/cursortest.c
@@ -236,6 +236,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
{
int i,j;
rfbCursorPtr c = screen->cursor;
+ int maskStride=(c->width+7)/8;
if(!c)
return;
@@ -252,10 +253,14 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
for(j=0;j<c->height;j++)
for(i=0;i<c->width;i++) {
- unsigned char value=0x100*j/c->height;
- rfbBool masked=(c->mask[(i/8)+(c->width+7)/8*j]<<(i&7))&0x80;
+ unsigned char value=0x100*i/c->width;
+ rfbBool masked=(c->mask[(i/8)+maskStride*j]<<(i&7))&0x80;
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 */