From 5c3eae92371309d94a5edd4e35caa71a2e481ab9 Mon Sep 17 00:00:00 2001 From: dscho Date: Wed, 26 Sep 2001 21:20:27 +0000 Subject: API corrections --- pnmshow.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pnmshow.c') diff --git a/pnmshow.c b/pnmshow.c index 15644e7..8f4ceed 100644 --- a/pnmshow.c +++ b/pnmshow.c @@ -45,7 +45,7 @@ int main(int argc,char** argv) paddedWidth+=4-(width&3); /* initialize data for vnc server */ - rfbScreen = rfbDefaultScreenInit(argc,argv,width,height,8,3,4); + rfbScreen = rfbGetScreen(argc,argv,paddedWidth,height,8,3,4); if(argc>1) rfbScreen->desktopName = argv[1]; else @@ -57,19 +57,25 @@ int main(int argc,char** argv) rfbScreen->httpDir = "./classes"; /* allocate picture and read it */ - rfbScreen->frameBuffer = (char*)calloc(paddedWidth*4,height); + rfbScreen->frameBuffer = (char*)malloc(paddedWidth*4*height); fread(rfbScreen->frameBuffer,width*3,height,in); fclose(in); /* correct the format to 4 bytes instead of 3 (and pad to paddedWidth) */ - for(j=height-1;j>=0;j--) + for(j=height-1;j>=0;j--) { for(i=width-1;i>=0;i--) for(k=2;k>=0;k--) rfbScreen->frameBuffer[(j*paddedWidth+i)*4+k]= rfbScreen->frameBuffer[(j*width+i)*3+k]; + for(i=width*4;iframeBuffer[j*paddedWidth*4+i]=0; + } + + /* initialize server */ + rfbInitServer(rfbScreen); /* run event loop */ - runEventLoop(rfbScreen,40000,FALSE); + rfbRunEventLoop(rfbScreen,40000,FALSE); return(0); } -- cgit v1.2.3