nanogui: Error with GrArea() call.
Subject:
Error with GrArea() call.
From:
####@####.####
Date:
18 Oct 2004 21:01:56 +0100
Message-Id: <001b01c4b54c$fca3ed40$010010ac@tridsys.com>
Hi,
I'm running Linux-2.4.19 on an Applied Data Systems BitsyX board and I have a problem with the GrArea() call.
My code gets an RGB picture from a socket, displays it to the screen:
I've tried passing GrArea a memory address with canned data in it, and I still get the same problem.
My error is as follows:
nano-X: fblin8.c:91: linear8_drawhorzline: Assertion `c < psd->ncolors' failed.
246: Aborted
nxclient: lost connection to Nano-X server
Broken pipe
Below is my code. I've eliminated extra stuff that works fine, like all the socket communications.
Any help or direction would help me greatly. Thank you very much in advance.
-Jimmy Olooney
####@####.####
Source Code:
typedef struct
{
GR_WINDOW_ID wid;
GR_GC_ID gc;
GR_TIMER_ID tid;
int done;
} gfx_state;
int main(int argc, char* argv[])
{
//Open socket
if (GrOpen() < 0)
{
printf("Can't open graphics\n");
return 0;
}
state->wid = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, 320, 240, 4, WHITE, BLUE);
GrSetGCForeground(state->gc, BLACK);
GrSetGCUseBackground(state->gc, GR_FALSE);
GrSelectEvents(state->wid, GR_EVENT_MASK_CLOSE_REQ | GR_EVENT_MASK_TIMER);
GrMapWindow(state->wid);
state->gc = GrNewGC();
state->tid = GrCreateTimer(state->wid, 33);
state->done = 0;
elapsed_time = 0;
start_time = time(NULL);
while(!state->done)
{
GrGetNextEvent(&event);
switch(event.type)
{
case GR_EVENT_TYPE_CLOSE_REQ:
state->done = 1;
break;
case GR_EVENT_TYPE_TIMER:
if(event.timer.tid == state->tid)
{
GrDestroyTimer(state->tid);
state->tid = GrCreateTimer(state->wid, 33);
//Get stuff form socket
//Convert RGB to TC565
//ERROR APPEARS ON THIS CALL
GrArea(state->wid, state->gc, 0, 0, 320, 240, pcTC565buffer, MWPF_TRUECOLOR565);
}
break;
default:
break;
}
}
close(hSocket);
free(state);
return 0;
}