static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) { ggiPutBox(ggi_conf.drawvis, vo_dx + x, vo_dy + y, w, h, src[0]); if ((ggi_conf.flushregion.x1 == -1) || ((vo_dx + x) < ggi_conf.flushregion.x1)) { ggi_conf.flushregion.x1 = vo_dx + x; } if ((ggi_conf.flushregion.y1 == -1) || ((vo_dy + y) < ggi_conf.flushregion.y1)) { ggi_conf.flushregion.y1 = vo_dy + y; } if ((ggi_conf.flushregion.x2 == -1) || ((vo_dx + x + w) > ggi_conf.flushregion.x2)) { ggi_conf.flushregion.x2 = vo_dx + x + w; } if ((ggi_conf.flushregion.y2 == -1) || ((vo_dy + y + h) > ggi_conf.flushregion.y2)) { ggi_conf.flushregion.y2 = vo_dy + y + h; } return (1); }
static int draw_frame(uint8_t *src[]) { ggiPutBox(ggi_conf.drawvis, vo_dx, vo_dy, vo_dwidth, vo_dheight, src[0]); ggi_conf.flushregion.x1 = vo_dx; ggi_conf.flushregion.y1 = vo_dy; ggi_conf.flushregion.x2 = vo_dwidth; ggi_conf.flushregion.y2 = vo_dheight; return (0); }
//put image (real screen only) void x_putimg(int xz,int yz, char *bitmap, int op) { int w; int h; w = *(short int *)bitmap; h = *(short int *)&bitmap[sizeof(short int)]; // if(xz>=0 && xz+w<=x_maxx() && yz>=0 && yz+h<=x_maxy()) #ifdef GGI ggiPutBox(ggiVis, xz, yz, w, h, (void *) &bitmap[2*sizeof(short int)]); #else gl_putbox(xz,yz,w,h,&bitmap[2*sizeof(short int)]); #endif }
static void perf_PUTBOX(TeleUser *u, TeleCmdGetPutData *d) { /* Put a pixel matrix */ ggi_pixel *src = (ggi_pixel *)d->pixel; if ((d->x < 0) || (d->y < 0) || (d->x + d->width > vis_mode.virt.x) || (d->y + d->height > vis_mode.virt.y)) { fprintf(stderr, "teleserver: ILLEGAL PUTBOX (%d,%d) " "%dx%d.\n", (int) d->x, (int) d->y, (int) d->width, (int) d->height); return; } /* if */ ggiPutBox(vis, d->x, d->y, d->width, d->height, src); } /* perf_PUTBOX */
static void animate_one_frame(ggi_visual_t vis, int x, int y, int w, int h, ggi_pixel * buf, int x2) { ggiDrawHLine(vis, x, y, w); ggiDrawHLine(vis, x, y + h - 1, w); ggiDrawVLine(vis, x, y, h); ggiDrawVLine(vis, x + w - 1, y, h); ggiDrawBox(vis, x + 2, y + 2, w - 4, h - 4); ggiGetBox(vis, x + 5, y + 5, w - 10, h / 2 - 7, buf); ggiPutBox(vis, x + 5, y + 5, w - 10, h / 2 - 7, buf); ggiCopyBox(vis, x + 5, y + h / 2, w - 10, h / 2 - 5, x + 5, y + h / 2); ggiPuts(vis, x + 7, y + 7, "Get/Put"); ggiPuts(vis, x + 7, y + h / 2 + 2, "Copy"); ggiDrawBox(vis, x2, y, 5, 5); }
void gr_update() { ggiFlush(screenvis); if (!use_directbuffer) ggiPutBox(screenvis, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h, screenbuffer); }
double Display(GLuint l,int *maxframes) { int x,y; GLfloat col[]={.25,0,.25,1}; int frames=0; struct timeval start,stop; double len; GLfloat rotate=0; gettimeofday(&start,NULL); while(1) { glClearColor(0,0,0,0); glClearIndex(0); #ifdef ZBUFFER glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); #else glClear(GL_COLOR_BUFFER_BIT); #endif glPushMatrix(); glRotatef(30,1,0,0); glRotatef(rotate/10,0,0,1); glTranslatef(-6,-4,0); for (y=0;y<3;y++) { glPushMatrix(); for (x=0;x<5;x++) { glPushMatrix(); glRotatef(rotate,y+1,-x-1,0); col[0]=(GLfloat)(x+1)/4; col[1]=0; col[2]=(GLfloat)(y+1)/2; glMaterialfv(GL_FRONT,GL_AMBIENT,col); glCallList(l); glPopMatrix(); glTranslatef(3,0,0); } glPopMatrix(); glTranslatef(0,4,0); } glPopMatrix(); glFinish(); ggiPutBox(vis,0,0,screen_x,screen_y,ggiDBGetBuffer(vis,0)->read); rotate+=10; frames++; if (frames==(*maxframes)) break; if (ggiKbhit(vis)) { *maxframes=frames; break; } } gettimeofday(&stop,NULL); len=(double)(stop.tv_sec-start.tv_sec)+ (double)(stop.tv_usec-start.tv_usec)/1e6; return len; }