Ejemplo n.º 1
0
// すだれ落ち&左->右
static void ec9_cb(surface_t *sfsrc, surface_t *sfdst) {
#define EC9DELTA 16
	int curstep, maxstep; 
	int i, t, x, y;

	maxstep = MAX(sfsrc->height / EC9DELTA + EC9DELTA,
		      sfsrc->width  / EC9DELTA + EC9DELTA);
	
	curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
	WARNING("step = %d\n", curstep);
	
	if (ecp.oldstep == curstep) {
		usleep(0);
		return;
	}
	t = ecp.oldstep;
	while(t < curstep) {
		for (i = 0; i < MIN(t + 1, EC9DELTA); i++) {
			y = i + EC9DELTA * (t - i);
			if (y < 0 || y >= sfsrc->height) continue;
			gr_copy(sf0, 0, y,
				sfdst, 0, y, sfsrc->width, 1);
		}
		for (i = 0; i < MIN(t + 1, EC9DELTA); i++) {
			x = i + EC9DELTA * (t - i);
			if (x < 0 || x >= sfsrc->width) continue;
			gr_copy(sf0,   x, 0,
				sfdst, x, 0, 1, sfsrc->height);
		}
		t++;
	}
	
	ecp.oldstep = curstep;
	ags_updateFull();
}
Ejemplo n.º 2
0
// 下->上クロスフェード
static void ec13_cb(surface_t *src, surface_t *dst) {
#define EC13DELTA 256
	int curstep, maxstep = src->height + EC12DELTA;
	int j, st_i, ed_i, l;
	int syy1 = 0 + dst->height -1;
	int syy2 = 0 + src->height -1;
	int dyy  = 0 + sf0->height -1;
	
	curstep = maxstep * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
	WARNING("step = %d\n", curstep);
	
	if (ecp.oldstep == curstep) {
		usleep(0); return;
	}
	
	st_i = MAX(0, curstep - EC13DELTA + 1);
	ed_i = MIN(src->height -1, curstep);
	l = ed_i - st_i + 1;
	for (j = st_i; j < ed_i; j++) {
		gre_Blend(sf0, 0, dyy - j, src, 0, syy1-j, dst, 0, syy2-j, src->width, 1, curstep - j);
	}
	if ((st_i - ecp.oldstep) > 1) {
		gr_copy(sf0, 0, dyy-ecp.oldstep, dst, 0, syy2-ecp.oldstep, src->width, st_i - ecp.oldstep);
		ags_updateArea(0, dyy-ecp.oldstep, src->width, st_i - ecp.oldstep);
	}
	
	ags_updateArea(0, dyy-ed_i, src->width, l);
	ecp.oldstep = st_i;
}
Ejemplo n.º 3
0
void Copy() {
	/*
	  Gpx.Copy(): 指定 surface 領域のコピー
	  
	   ds: 転送先 surface 番号
	   dx: 転送先 x 座標
	   dy: 転送先 y 座標
	   ss: 転送元 surface 番号
	   sx: 転送元 x 座標
	   sy: 転送元 y 座標
	   sw: 転送元 幅
	   sh: 転送元 高さ
	*/
	int ds = getCaliValue();
	int dx = getCaliValue();
	int dy = getCaliValue();
	int ss = getCaliValue();
	int sx = getCaliValue();
	int sy = getCaliValue();
	int sw = getCaliValue();
	int sh = getCaliValue();
	surface_t *src, *dst;
	
	DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, ss, sx, sy, sw, sh);
	
	ags_sync();
	src = sf_get(ss);
	dst = sf_get(ds);
	gr_copy(dst, dx, dy, src, sx, sy, sw, sh);
}
Ejemplo n.º 4
0
// 元のCGの一部を切りぬいたCGを作成
int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
	cginfo_t *i, *srccg;
	surface_t *dst, *src;
	
	spcg_assert_no(wNumDstCG);
	spcg_assert_no(wNumSrcCG);
	
	// 元にするCGを参照 (LINKCGなら読み込み)
	if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
		return NG;
	}
	
	i = g_new(cginfo_t, 1);
	i->type = CG_SET;
	i->no = wNumDstCG;
	i->refcnt = 0;

	src = srccg->sf;
	if (src->has_alpha) {
		dst = sf_create_surface(src->width, src->height, src->depth);
		gr_fill_alpha_map(dst, 0, 0, src->width, src->height, 255);
	} else {
		dst = sf_create_pixel(src->width, src->height, src->depth);
	}
	
	if (src->has_pixel) {
		gr_copy(dst, wX, wY, src, wX, wY, wWidth, wHeight);
	}
	if (src->has_alpha) {
		gr_copy_alpha_map(dst, wX, wY, src, wX, wY, wWidth, wHeight);
	}
	
	i->sf = dst;
	
	// もし前に作成したものがあり、未開放の場合は開放
	scg_free(wNumDstCG);
	
	sact.cg[wNumDstCG] = i;
	
	return OK;
}
Ejemplo n.º 5
0
static int
gr_update(struct group * grp, char const * group)
{
	int pfd, tfd;
	struct group *gr = NULL;
	struct group *old_gr = NULL;

	if (grp != NULL)
		gr = gr_dup(grp);

	if (group != NULL)
		old_gr = GETGRNAM(group);

	if (gr_init(conf.etcpath, NULL))
		err(1, "gr_init()");

	if ((pfd = gr_lock()) == -1) {
		gr_fini();
		err(1, "gr_lock()");
	}
	if ((tfd = gr_tmp(-1)) == -1) {
		gr_fini();
		err(1, "gr_tmp()");
	}
	if (gr_copy(pfd, tfd, gr, old_gr) == -1) {
		gr_fini();
		close(tfd);
		err(1, "gr_copy()");
	}
	fsync(tfd);
	close(tfd);
	if (gr_mkdb() == -1) {
		gr_fini();
		err(1, "gr_mkdb()");
	}
	free(gr);
	gr_fini();
	return 0;
}