Пример #1
0
int mdp_ppp_blit(struct mdp_info *mdp, struct fb_info *fb,
		 struct mdp_blit_req *req)
{
	int ret;
	unsigned long src_start = 0, src_len = 0, dst_start = 0, dst_len = 0;
	struct file *src_file = 0, *dst_file = 0;

	ret = mdp_ppp_validate_blit(mdp, req);
	if (ret)
		return ret;

	/* do this first so that if this fails, the caller can always
	 * safely call put_img */
	if (unlikely(get_img(&req->src, fb, &src_start, &src_len, &src_file))) {
		PR_DISP_ERR("mdp_ppp: could not retrieve src image from "
				"memory\n");
		return -EINVAL;
	}

	if (unlikely(get_img(&req->dst, fb, &dst_start, &dst_len, &dst_file))) {
		PR_DISP_ERR("mdp_ppp: could not retrieve dst image from "
				"memory\n");
		put_img(src_file);
		return -EINVAL;
	}

	if (unlikely(req->src.format > ARRAY_SIZE(src_img_cfg) ||
		req->dst.format > ARRAY_SIZE(dst_img_cfg))) {
		return -EINVAL;
	}

	mutex_lock(&mdp_mutex);

	/* transp_masking unimplemented */
	req->transp_mask = MDP_TRANSP_NOP;
	mdp->req = req;

	ret = mdp_ppp_do_blit(mdp, req, src_file, src_start, src_len,
			      dst_file, dst_start, dst_len);

	put_img(src_file);
	put_img(dst_file);
	mutex_unlock(&mdp_mutex);
	return ret;
}
Пример #2
0
int		ft_key_print(int key, t_struct *s)
{
	key_rgb(key, s);
	if (key == 85)
	{
		init_color(s);
		s->color++;
		if (s->color == 6)
		s->color = 0;
	}
	if (key == 53)
	{
		exit(2);
		mlx_destroy_image(s->mlx, s->ptr_img);
		mlx_destroy_window(s->mlx, s->win);
	}
	if (key == 125)
		s->y1 *= 1.01;
	if (key == 126)
		s->y1 *= 0.99;
	if (key == 124)
		s->x1 -= 0.01;
	if (key == 123)
		s->x1 += 0.01;
	if (key == 69)
	{
		s->iter_max += 1;
		s->zoom *= 1.05;
	}
	if (key == 78)
	{
		s->iter_max -= 1;
		s->zoom *= 0.97;
	}
	if (key == 75)
		s->iter_max += 1;
	if (key == 67)
		s->iter_max -= 1;
	if (key == 83)
	{
		s->type++;
		s->bol = 0;
		if (s->type == 5)
			s->type = 1;
	}
	if (key == 84)
	{
		if (s->bw == 1)
		s->bw = 0;
		else
		s->bw = 1;
	}
	put_img(s);
	return (1);
}