Exemple #1
0
void
sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
    int len;
    vm_offset_t p1, p2;

    if (at + count > vtb->vtb_size)
        count = vtb->vtb_size - at;
    len = vtb->vtb_size - at - count;
    if (len > 0) {
        p1 = vtb_pointer(vtb, at + count);
        p2 = vtb_pointer(vtb, at);
        if (vtb->vtb_type == VTB_FRAMEBUFFER) {
            bcopy_io(p1, p2, len*sizeof(u_int16_t));
            bcopy_io(p1 + ATTR_OFFSET_FB,
                     p2 + ATTR_OFFSET_FB,
                     len*sizeof(u_int16_t));
        } else {
            bcopy((void *)p1, (void *)p2, len*sizeof(u_int16_t));
            bcopy((void *)(p1 + attr_offset(vtb)),
                  (void *)(p2 + attr_offset(vtb)),
                  len*sizeof(u_int16_t));
        }
    }
    p1 = vtb_pointer(vtb, at + len);
    if (vtb->vtb_type == VTB_FRAMEBUFFER) {
        fillw_io(c, p1, vtb->vtb_size - at - len);
        fillw_io(at2pc98(attr), p1 + ATTR_OFFSET_FB,
                 vtb->vtb_size - at - len);
    } else {
        fillw(c, (void *)p1, vtb->vtb_size - at - len);
        fillw(at2pc98(attr), (void *)(p1 + attr_offset(vtb)),
              vtb->vtb_size - at - len);
    }
}
Exemple #2
0
void
sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
    vm_offset_t p1, p2;

    p1 = vtb_pointer(vtb, at);
    if (at + count > vtb->vtb_size) {
        count = vtb->vtb_size - at;
    } else {
        p2 = vtb_pointer(vtb, at + count);
        if (vtb->vtb_type == VTB_FRAMEBUFFER) {
            bcopy_io(p1, p2,
                     (vtb->vtb_size - at - count)*sizeof(u_int16_t));
            bcopy_io(p1 + ATTR_OFFSET_FB,
                     p2 + ATTR_OFFSET_FB,
                     (vtb->vtb_size - at - count)*sizeof(u_int16_t));
        } else {
            bcopy((void *)p1, (void *)p2,
                  (vtb->vtb_size - at - count)*sizeof(u_int16_t));
            bcopy((void *)(p1 + attr_offset(vtb)),
                  (void *)(p2 + attr_offset(vtb)),
                  (vtb->vtb_size - at - count)*sizeof(u_int16_t));
        }
    }
    if (vtb->vtb_type == VTB_FRAMEBUFFER) {
        fillw_io(c, p1, count);
        fillw_io(at2pc98(attr), p1 + ATTR_OFFSET_FB, count);
    } else {
        fillw(c, (void *)p1, count);
        fillw(at2pc98(attr), (void *)(p1 + attr_offset(vtb)), count);
    }
}
Exemple #3
0
void
sc_vtb_clear(sc_vtb_t *vtb, int c, int attr)
{
    vm_offset_t p = vtb_pointer(vtb, 0);

    if (vtb->vtb_type == VTB_FRAMEBUFFER) {
        fillw_io(c, p, vtb->vtb_size);
        fillw_io(at2pc98(attr), p + ATTR_OFFSET_FB, vtb->vtb_size);
    } else {
        fillw(c, (void *)p, vtb->vtb_size);
        fillw(at2pc98(attr), (void *)(p + attr_offset(vtb)),
              vtb->vtb_size);
    }
}
Exemple #4
0
void
sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	int len;

	if (at + count > vtb->vtb_size)
		count = vtb->vtb_size - at;
	len = vtb->vtb_size - at - count;
	if (len > 0) {
#ifndef __sparc64__
		if (vtb->vtb_type == VTB_FRAMEBUFFER)
			bcopy_io(sc_vtb_pointer(vtb, at + count),
				 sc_vtb_pointer(vtb, at),
				 len*sizeof(u_int16_t)); 
		else
#endif
			bcopy((void *)sc_vtb_pointer(vtb, at + count),
			      (void *)sc_vtb_pointer(vtb, at),
			      len*sizeof(u_int16_t)); 
	}
#ifndef __sparc64__
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, sc_vtb_pointer(vtb, at + len),
			 vtb->vtb_size - at - len);
	else
#endif
		fillw(attr | c, (void *)sc_vtb_pointer(vtb, at + len),
		      vtb->vtb_size - at - len);
}
Exemple #5
0
void
sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
    vm_offset_t p;

    if (at + count > vtb->vtb_size)
        count = vtb->vtb_size - at;
    p = vtb_pointer(vtb, at);
    if (vtb->vtb_type == VTB_FRAMEBUFFER) {
        fillw_io(c, p, count);
        fillw_io(at2pc98(attr), p + ATTR_OFFSET_FB, count);
    } else {
        fillw(c, (void *)p, count);
        fillw(at2pc98(attr), (void *)(p + attr_offset(vtb)), count);
    }
}
Exemple #6
0
void
sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	int len;

	if (at + count > vtb->vtb_size)
		count = vtb->vtb_size - at;
	len = vtb->vtb_size - at - count;
	if (len > 0) {
		if (vtb->vtb_type == VTB_FRAMEBUFFER) {
			bcopy_io(vtb->vtb_buffer + at + count,
				 vtb->vtb_buffer + at,
				 len*sizeof(uint16_t)); 
		} else {
			bcopy(vtb->vtb_buffer + at + count,
			      vtb->vtb_buffer + at,
			      len*sizeof(uint16_t)); 
		}
	}
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, vtb->vtb_buffer + at + len,
			 vtb->vtb_size - at - len);
	else
		fillw(attr | c, vtb->vtb_buffer + at + len,
		      vtb->vtb_size - at - len);
}
Exemple #7
0
void
sc_vtb_clear(sc_vtb_t *vtb, int c, int attr)
{
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, vtb->vtb_buffer, vtb->vtb_size);
	else
		fillw(attr | c, vtb->vtb_buffer, vtb->vtb_size);
}
Exemple #8
0
void
sc_vtb_clear(sc_vtb_t *vtb, int c, int attr)
{
#ifndef __sparc64__
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, sc_vtb_pointer(vtb, 0), vtb->vtb_size);
	else
#endif
		fillw(attr | c, (void *)sc_vtb_pointer(vtb, 0), vtb->vtb_size);
}
Exemple #9
0
void
sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	if (at + count > vtb->vtb_size)
		count = vtb->vtb_size - at;
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, vtb->vtb_buffer + at, count);
	else
		fillw(attr | c, vtb->vtb_buffer + at, count);
}
Exemple #10
0
void
sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	if (at + count > vtb->vtb_size)
		count = vtb->vtb_size - at;
#ifndef __sparc64__
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
	else
#endif
		fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
}
Exemple #11
0
static int
snake_saver(video_adapter_t *adp, int blank)
{
	static int	dirx, diry;
	int		f;
	scr_stat	*scp = cur_console;

/* XXX hack for minimal changes. */
#define	save	message
#define	savs	messagep

	if (blank) {
		if (adp->va_info.vi_flags & V_INFO_GRAPHICS)
			return EAGAIN;
		if (blanked <= 0) {
			window = (u_short *)adp->va_window;
			fillw(((FG_LIGHTGREY|BG_BLACK)<<8) | scr_map[0x20],
			      window, scp->xsize * scp->ysize);
			set_border(scp, 0);
			dirx = (scp->xpos ? 1 : -1);
			diry = (scp->ypos ?
				scp->xsize : -scp->xsize);
			for (f=0; f< messagelen; f++)
				savs[f] = (u_char *)window + 2 *
					  (scp->xpos+scp->ypos*scp->xsize);
			*(savs[0]) = scr_map[*save];
			blanked = 1;
		}
		if (blanked++ < 4)
			return 0;
		blanked = 1;
		*(savs[messagelen-1]) = scr_map[0x20];
		for (f=messagelen-1; f > 0; f--)
			savs[f] = savs[f-1];
		f = (savs[0] - (u_char *)window) / 2;
		if ((f % scp->xsize) == 0 ||
		    (f % scp->xsize) == scp->xsize - 1 ||
		    (random() % 50) == 0)
			dirx = -dirx;
		if ((f / scp->xsize) == 0 ||
		    (f / scp->xsize) == scp->ysize - 1 ||
		    (random() % 20) == 0)
			diry = -diry;
		savs[0] += 2*dirx + 2*diry;
		for (f=messagelen-1; f>=0; f--)
			*(savs[f]) = scr_map[save[f]];
	}
	else {
		blanked = 0;
	}
	return 0;
}
Exemple #12
0
void
sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	if (at + count > vtb->vtb_size) {
		count = vtb->vtb_size - at;
	} else {
		if (vtb->vtb_type == VTB_FRAMEBUFFER) {
			bcopy_io(vtb->vtb_buffer + at,
				 vtb->vtb_buffer + at + count,
				 (vtb->vtb_size - at - count)*sizeof(uint16_t));
		} else {
			bcopy(vtb->vtb_buffer + at,
			      vtb->vtb_buffer + at + count,
			      (vtb->vtb_size - at - count)*sizeof(uint16_t)); 
		}
	}
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, vtb->vtb_buffer + at, count);
	else
		fillw(attr | c, vtb->vtb_buffer + at, count);
}
Exemple #13
0
void
sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
	if (at + count > vtb->vtb_size)
		count = vtb->vtb_size - at;
	else {
#ifndef __sparc64__
		if (vtb->vtb_type == VTB_FRAMEBUFFER)
			bcopy_io(sc_vtb_pointer(vtb, at),
				 sc_vtb_pointer(vtb, at + count),
				 (vtb->vtb_size - at - count)*sizeof(u_int16_t)); 
		else
#endif
			bcopy((void *)sc_vtb_pointer(vtb, at),
			      (void *)sc_vtb_pointer(vtb, at + count),
			      (vtb->vtb_size - at - count)*sizeof(u_int16_t)); 
	}
#ifndef __sparc64__
	if (vtb->vtb_type == VTB_FRAMEBUFFER)
		fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
	else
#endif
		fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
}
void videotest()
{

    //int ysize = 60;
    //int xsize = 80;
    //char win[ysize*xsize*3];

#if 0
    const char *bpm = "../../plib/resources/backgrounds/phantom_dz_large.pbm";

    {
        FILE *f = fopen(bpm, "r" );
        if(f == NULL )
        {
            printf("can't open %s\n", bpm );
            exit(33);
        }

        fseek( f, 0, SEEK_END );
        long size = ftell( f );
        fseek( f, 0, SEEK_SET );

        printf("Size of %s is %ld\n", bpm, size );

        char *data = malloc(size);

        fread( data, size, 1, f );
        fclose(f);

        struct drv_video_bitmap_t *bmp;
        int result = bmp_ppm_load( &bmp, data );

        free(data);

        if(result)
            printf("can't parse %s: %d\n", bpm, result );
        else
        {
            drv_video_bitblt(bmp->pixel, 0, 0, bmp->xsize, bmp->ysize, 0xFF );
        }

        bmp_pixels = bmp->pixel;
        bmpxs = bmp->xsize;
        bmpys = bmp->ysize;


    }
#endif

    int i;

    for( i = 0; i < 10; i++ )
    {
        fillw( (i+2)*10, (i+2)*20, (i+4)*10 );

//#if VIDEO_ZBUF
        drv_video_bitblt(win, 0, i*10, wxsize, wysize, i & 1 ? 0xFF : 0x55 );
//#else
//        drv_video_bitblt(win, 0, i*10, wxsize, wysize );
//#endif
        //drv_win_screen_update();
        //drv_video_update();
    }


    //drv_video_window_t *w = malloc(drv_video_window_bytes(140,80));
    //w->xsize = 140;
    //w->ysize = 80;

    drv_video_window_t *w = drv_video_window_create( 140,80, 200, 200, COLOR_LIGHTGRAY, "Test Window" );

    //drv_video_window_clear( w );
    //drv_video_window_fill( w, COLOR_LIGHTGRAY );
    drv_video_winblt( w );

    //flame(w);

    drv_video_window_draw_line( w, 1, 1, 110, 20, COLOR_RED );
    drv_video_window_draw_line( w, 110, 1, 110, 20, COLOR_RED );
    drv_video_window_draw_line( w, 1, 20, 110, 20, COLOR_GREEN );

    drv_video_window_fill_ellipse( w, 30, 30, 15, 27, COLOR_BLUE );

    drv_video_window_fill_box( w,  40, 32, 33, 10, COLOR_RED );

    drv_video_window_draw_box( w, 45, 37, 33, 12, COLOR_BLACK );

    drv_video_winblt( w );

    getchar();

//#if VIDEO_ZBUF
    video_zbuf_reset();

    fillw( 0xFF, 0, 0 );
    drv_video_bitblt(win, 550, 100, wxsize, wysize, 0xEF );

    //video_zbuf_dump();

    fillw( 0, 0xFF, 0 );
    drv_video_bitblt(win, 575, 120, wxsize, wysize, 0xEE );
    drv_video_bitblt(win, 700, 400, wxsize, wysize, 0xEE );
//#endif
    video_zbuf_reset();

//getchar();

#if 1
    drv_video_font_scroll_line( w, &drv_video_8x16san_font, COLOR_DARKGRAY );
    drv_video_font_draw_string( w, &drv_video_8x16san_font, "Test font", COLOR_BLACK, 0, 0 );
    drv_video_font_scroll_line( w, &drv_video_8x16san_font, COLOR_LIGHTGRAY );
    drv_video_font_draw_string( w, &drv_video_8x16san_font, "Line 2 ok", COLOR_BLACK, 0, 0 );
    drv_video_font_scroll_line( w, &drv_video_8x16san_font, COLOR_DARKGRAY );
    drv_video_font_draw_string( w, &drv_video_8x16san_font, "GIMME THAT", COLOR_BLACK, 0, 0 );
#else
    int ttx = 0, tty = 0;
    drv_video_font_tty_string( w, &drv_video_8x16san_font,
                               "Just a little bit long text\nFrom a new line",
                               //"Just a little bit long ",
                               COLOR_BLACK, COLOR_LIGHTGRAY,
                               &ttx, &tty );
#endif
    drv_video_winblt( w );
//getchar();
}