/* ** SWimp_EndFrame ** ** This does an implementation specific copy from the backbuffer to the ** front buffer. In the Win32 case it uses BitBlt or BltFast depending ** on whether we're using DIB sections/GDI or DDRAW. */ void SWimp_EndFrame (void) { if (!vga_oktowrite()) return; // can't update screen if it's not active // if (vid_waitforrefresh.value) // vga_waitretrace(); if (VGA_planar) VGA_UpdatePlanarScreen (vid.buffer); else { int total = vid.rowbytes * vid.height; int offset; for (offset=0;offset<total;offset+=0x10000) { vga_setpage(offset/0x10000); memcpy(framebuffer_ptr, vid.buffer + offset, ((total-offset>0x10000)?0x10000:(total-offset))); } } }
/* ** SWimp_SetPalette ** ** System specific palette setting routine. A NULL palette means ** to use the existing palette. The palette is expected to be in ** a padded 4-byte xRGB format. */ void SWimp_SetPalette( const unsigned char *palette ) { static int tmppal[256*3]; const unsigned char *pal; int *tp; int i; if ( !palette ) palette = ( const unsigned char * ) sw_state.currentpalette; if (vga_getcolors() == 256) { tp = tmppal; pal = palette; for (i=0 ; i < 256 ; i++, pal += 4, tp += 3) { tp[0] = pal[0] >> 2; tp[1] = pal[1] >> 2; tp[2] = pal[2] >> 2; } if (vga_oktowrite()) vga_setpalvec(0, 256, tmppal); }
int vga_clear(void) { vga_screenoff(); #ifdef BACKGROUND __svgalib_dont_switch_vt_yet(); #endif if (MODEX) goto modeX; switch (CM) { case G320x200x256: case G320x240x256: case G320x400x256: case G360x480x256: modeX: #ifdef BACKGROUND if (vga_oktowrite()) { #endif /* write to all planes */ port_out(0x02, SEQ_I); port_out(0x0F, SEQ_D); /* clear video memory */ memset(GM, 0, 65536); #ifdef BACKGROUND } else { int i; for (i = 0; i < 4; i++) { /* save plane i */ __svgalib_fast_setpage(i); memset(GM, 0, GRAPH_SIZE); } } #endif break; default: switch (CI.colors) { case 2: case 16: vga_setcolor(0); #ifdef BACKGROUND if (vga_oktowrite()) { #endif /* write to all bits */ port_out(0x08, GRA_I); port_out(0xFF, GRA_D); #ifdef BACKGROUND } #endif default: { int i; int pages = (CI.ydim * CI.xbytes + 65535) >> 16; #if defined(CONFIG_ALPHA_JENSEN) int j; #endif #ifdef BACKGROUND if (!vga_oktowrite()) { switch (CI.colors) { case 2: case 16: pages*=4; } } #endif for (i = 0; i < pages; ++i) { vga_setpage(i); #if defined(CONFIG_ALPHA_JENSEN) for (j = 0; j < 65536; j += 2) gr_writew(0, j); #else /* clear video memory */ memset(GM, 0, 65536); #endif } } break; } break; } vga_setcolor(15); #ifdef BACKGROUND __svgalib_is_vt_switching_needed(); #endif vga_screenon(); return 0; }
void graphicsinit(char *svgamode) //initialization of graphics, mode according to X_LOPIF { const short cur[32] = { 0x9FFF, 0x0FFF, 0x07FF, 0x83FF, 0xC1FF, 0xE0FF, 0xF067, 0xF003, 0xF001, 0xF000, 0xF800, 0xF800, 0xF800, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x6000, 0x7000, 0x3800, 0x1C00, 0x0E00, 0x0700, 0x0018, 0x07EC, 0x07EE, 0x001E, 0x03EE, 0x03EE, 0x001E, 0x00EC, 0x0002 }; xg_256=MM_Hic; //set Hicolor flag... initpalette(); x_settextjusty(0,2); // always write text from upper left corner #ifdef GGI // printf("Initializing GGI visual target.\n"); ggiVis = ggiOpen (NULL); ggiGetMode (ggiVis, &origMode); ggiSetSimpleMode (ggiVis, 800, 600, 1, GT_16BIT); SVGAx=799; SVGAy=599; ggiAddFlags(ggiVis,GGIFLAG_ASYNC); #else strupr(svgamode); // printf("Console switched to graphics mode.\n"); if(strstr(svgamode,".I")) { vga_setmode(G640x480x64K); gl_setcontextvga(G640x480x64K); SVGAx=639; SVGAy=479; } else if(strstr(svgamode,".K")) { vga_setmode(G1024x768x64K); gl_setcontextvga(G1024x768x64K); SVGAx=1023; SVGAy=767; } else if(strstr(svgamode,".L")) { vga_setmode(G1280x1024x64K); gl_setcontextvga(G1280x1024x64K); SVGAx=1279; SVGAy=1023; } if(strstr(svgamode,".M")) { vga_setmode(G1600x1200x64K); gl_setcontextvga(G1600x1200x64K); SVGAx=1599; SVGAy=1199; } { vga_setmode(G800x600x64K); gl_setcontextvga(G800x600x64K); SVGAx=799; SVGAy=599; } vga_runinbackground(1); vga_oktowrite(); gl_setwritemode(FONT_COMPRESSED|WRITEMODE_MASKED); gl_setfontcolors(0,vga_white()); //gl_setfont(8,8,gl_font8x8); gl_setrgbpalette(); gl_enableclipping(); #endif x_defcurs( (short *)cur, (short *)&cur[16], 15); //mouse kursor }