Ejemplo n.º 1
0
VoxelFile::VoxelFile(const QString & filename)
: data(NULL), model(NULL), shape(NULL)
{
    load_palette();
    load(filename);
}
Ejemplo n.º 2
0
VoxelFile::VoxelFile()
: data(NULL), model(NULL), shape(NULL)
{
    load_palette();
}
Ejemplo n.º 3
0
VoxelFile::VoxelFile(QFile & fp)
: data(NULL), model(NULL), shape(NULL)
{
    load_palette();
    load_fp(fp);
}
Ejemplo n.º 4
0
static int
pcx_draw(video_adapter_t *adp)
{
    u_char *vidmem;
    int swidth, sheight, sbpsl, sdepth, splanes;
    int banksize, origin;
    int c, i, j, pos, scan, x, y;
    u_char line[MAXSCANLINE];
    
    if (pcx_info.zlen < 1)
	return 1;

    load_palette(adp, pcx_info.palette);
    
    vidmem = (u_char *)adp->va_window;
    swidth = adp->va_info.vi_width;
    sheight = adp->va_info.vi_height;
    sbpsl = adp->va_line_width;
    sdepth = adp->va_info.vi_depth;
    splanes = adp->va_info.vi_planes;
    banksize = adp->va_window_size;
    
    for (origin = 0; origin < sheight*sbpsl; origin += banksize) {
	set_origin(adp, origin);
	bzero(vidmem, banksize);	
    }
    
    x = (swidth - pcx_info.width) / 2;
    y = (sheight - pcx_info.height) / 2;
    origin = 0;
    pos = y * sbpsl + x;
    while (pos > banksize) {
	pos -= banksize;
	origin += banksize;
    }
    set_origin(adp, origin);
    
    for (scan = i = 0; scan < pcx_info.height; ++scan, ++y, pos += sbpsl) {
	for (j = 0; j < pcx_info.bpsl && i < pcx_info.zlen; ++i) {
	    if ((pcx_info.zdata[i] & 0xc0) == 0xc0) {
		c = pcx_info.zdata[i++] & 0x3f;
		if (i >= pcx_info.zlen)
		    return 1;
	    } else {
		c = 1;
	    }
	    if (j + c > pcx_info.bpsl)
		return 1;
	    while (c--)
		line[j++] = pcx_info.zdata[i];
	}

	if (pos > banksize) {
	    origin += banksize;
	    pos -= banksize;
	    set_origin(adp, origin);
	}

	if (pos + pcx_info.width > banksize) {
	    /* scanline crosses bank boundary */
	    j = banksize - pos;
	    bcopy(line, vidmem + pos, j);
	    origin += banksize;
	    pos -= banksize;
	    set_origin(adp, origin);
	    bcopy(line + j, vidmem, pcx_info.width - j);
	} else {
	    bcopy(line, vidmem + pos, pcx_info.width);
	}
    }

    return 0;
}