summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2003-02-10 14:16:32 +0000
committerdscho <dscho>2003-02-10 14:16:32 +0000
commitbd9e5747e514ad33adc050a81dc4ff09a2a188e7 (patch)
tree6308f06e021f3956b176068d5c273b413feeba63
parent4a1355d13cceb68c84917b3022ee02f3af16610a (diff)
downloadlibtdevnc-bd9e5747e514ad33adc050a81dc4ff09a2a188e7.tar.gz
libtdevnc-bd9e5747e514ad33adc050a81dc4ff09a2a188e7.zip
added colourmapexample; fixed LinuxVNC to show the right colours
-rw-r--r--examples/.cvsignore2
-rw-r--r--examples/Makefile.am2
-rw-r--r--examples/colourmaptest.c32
-rw-r--r--vncterm/VNConsole.c5
4 files changed, 38 insertions, 3 deletions
diff --git a/examples/.cvsignore b/examples/.cvsignore
index 7aab2d4..61a17ba 100644
--- a/examples/.cvsignore
+++ b/examples/.cvsignore
@@ -9,4 +9,4 @@ storepasswd
vncev
Makefile.in
.deps
-
+colourmaptest
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 6875c21..c7635f5 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -10,7 +10,7 @@ endif
noinst_HEADERS=radon.h
noinst_PROGRAMS=example pnmshow regiontest pnmshow24 fontsel \
- vncev storepasswd $(BACKGROUND_TEST) $(MAC)
+ vncev storepasswd colourmaptest $(BACKGROUND_TEST) $(MAC)
LDADD = -L.. -lvncserver
diff --git a/examples/colourmaptest.c b/examples/colourmaptest.c
new file mode 100644
index 0000000..1e03f9e
--- /dev/null
+++ b/examples/colourmaptest.c
@@ -0,0 +1,32 @@
+#include "rfb.h"
+
+
+int main(int argc,char** argv)
+{
+ int i;
+ uint8_t bytes[256*3];
+
+ rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1);
+
+ server->rfbServerFormat.trueColour=FALSE;
+ server->colourMap.count=256;
+ server->colourMap.is16=FALSE;
+ for(i=0;i<256;i++) {
+ bytes[i*3+0]=255-i; /* red */
+ bytes[i*3+1]=0; /* green */
+ bytes[i*3+2]=i; /* blue */
+ }
+ bytes[128*3+0]=0xff;
+ bytes[128*3+1]=0;
+ bytes[128*3+2]=0;
+ server->colourMap.data.bytes=bytes;
+
+ server->frameBuffer=malloc(256*256);
+ for(i=0;i<256*256;i++)
+ server->frameBuffer[i]=(i/256);
+
+ rfbInitServer(server);
+ rfbRunEventLoop(server,-1,FALSE);
+
+ return(0);
+}
diff --git a/vncterm/VNConsole.c b/vncterm/VNConsole.c
index faf73ed..1335aee 100644
--- a/vncterm/VNConsole.c
+++ b/vncterm/VNConsole.c
@@ -24,11 +24,14 @@ unsigned char colourMap16[16*3]={
void MakeColourMap16(vncConsolePtr c)
{
+ int i,j;
rfbColourMap* colourMap=&(c->rfbScreen->colourMap);
if(colourMap->count)
free(colourMap->data.bytes);
colourMap->data.bytes=malloc(16*3);
- memcpy(colourMap->data.bytes,colourMap16,16*3);
+ for(i=0;i<16;i++)
+ for(j=0;j<3;j++)
+ colourMap->data.bytes[i*3+2-j]=colourMap16[i*3+j];
colourMap->count=16;
colourMap->is16=FALSE;
c->rfbScreen->rfbServerFormat.trueColour=FALSE;