Пример #1
0
Errcode vram_open_graphics(Vdevice *dev, VramRast *r,
							LONG width, LONG height, USHORT mode)
{
Errcode err;
int vmode;

if (mode >= sizeof(vram_infos)/sizeof(vram_infos[0]))
	return(Err_no_such_mode);
if (width != vram_infos[mode].width.actual ||
	height != vram_infos[mode].height.actual )
	return(Err_wrong_res);
if ((err = vram_detect(dev)) == Success)
	{
	vmode = mode_to_mode[mode];
	ivmode = get_xmode();
	set_xmode(vmode);
	if (get_xmode() != vmode)
		err = Err_no_vram;
	else
		{
		build_ytable();
		enable_ext();
		open_raster(dev, mode, r, width, height, RASTER0);
		vram_graphics_mode = mode;
		}
	}
return(err);
}
Пример #2
0
int insert_ytable(int y[][N],int row,int col,int key)
{
    if(y[row-1][col-1] < INF) {
        fprintf(stderr,"ytable is full y[%d][%d]:%d\n",row-1,col-1,y[row-1][col-1]);
        print_table(y,N,N);
        return -1;
    }
    

    y[row-1][col-1] = key;
    return build_ytable(y,row-1,col-1,row,col);
}
Пример #3
0
static int build_ytable(int y[][N],int m,int n,int row,int col)
{
    //printf("adjust key:y[%d][%d]:%d\n",m,n,y[m][n]);
    if(m== 0 && n ==0)
        return 0;
    
    if(0 == n) {
        if(y[m][n] < y[m-1][n]) 
        {
            __swap(&y[m][n],&y[m-1][n]);
            build_ytable(y,m-1,n,row,col);
        }
        
        return 0;
    }
    
    if(0 == m) {
        if(y[m][n] < y[m][n-1]) {
            __swap(&y[m][n],&y[m][n-1]);
            return build_ytable(y,m,n-1,row,col);
        }

        return 0;
    }

    if(y[m][n] < y[m-1][n]) {
        __swap(&y[m][n],&y[m-1][n]);
        build_ytable(y,m-1,n,row,col);
    }
    
    if(y[m][n] < y[m][n-1]) {
        __swap(&y[m][n], &y[m][n-1]);
        return build_ytable(y,m,n-1,row,col);
    }
    
    return 0;
}