Ejemplo n.º 1
0
static struct pipe_buffer *
setup_vertex_data_yuv(struct xorg_renderer *r,
                      float srcX, float srcY, float srcW, float srcH,
                      float dstX, float dstY, float dstW, float dstH,
                      struct pipe_texture **tex)
{
   float s0, t0, s1, t1;
   float spt0[2], spt1[2];

   spt0[0] = srcX;
   spt0[1] = srcY;
   spt1[0] = srcX + srcW;
   spt1[1] = srcY + srcH;

   s0 = spt0[0] / tex[0]->width[0];
   t0 = spt0[1] / tex[0]->height[0];
   s1 = spt1[0] / tex[0]->width[0];
   t1 = spt1[1] / tex[0]->height[0];

   /* 1st vertex */
   add_vertex_1tex(r, dstX, dstY, s0, t0);
   /* 2nd vertex */
   add_vertex_1tex(r, dstX + dstW, dstY,
                   s1, t0);
   /* 3rd vertex */
   add_vertex_1tex(r, dstX + dstW, dstY + dstH,
                   s1, t1);
   /* 4th vertex */
   add_vertex_1tex(r, dstX, dstY + dstH,
                   s0, t1);

   return renderer_buffer_create(r);
}
Ejemplo n.º 2
0
static INLINE void
renderer_draw(struct xa_context *r)
{
    struct pipe_context *pipe = r->pipe;
    struct pipe_resource *buf = 0;
    int num_verts = r->buffer_size / (r->attrs_per_vertex * NUM_COMPONENTS);

    if (!r->buffer_size)
	return;

    buf = renderer_buffer_create(r);

    if (buf) {
	cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);

	util_draw_vertex_buffer(pipe, r->cso, buf, 0, PIPE_PRIM_QUADS, num_verts,	/* verts */
				r->attrs_per_vertex);	/* attribs/vert */

	pipe_resource_reference(&buf, NULL);
    }
}
Ejemplo n.º 3
0
static INLINE void
renderer_draw(struct xorg_renderer *r)
{
   struct pipe_context *pipe = r->pipe;
   struct pipe_buffer *buf = 0;
   int num_verts = r->buffer_size/(r->attrs_per_vertex * NUM_COMPONENTS);

   if (!r->buffer_size)
      return;

   buf = renderer_buffer_create(r);


   if (buf) {
      util_draw_vertex_buffer(pipe, buf, 0,
                              PIPE_PRIM_QUADS,
                              num_verts,  /* verts */
                              r->attrs_per_vertex); /* attribs/vert */

      pipe_buffer_reference(&buf, NULL);
   }
}
Ejemplo n.º 4
0
static struct pipe_resource *
setup_vertex_data_yuv(struct xa_context *r,
		      float srcX,
		      float srcY,
		      float srcW,
		      float srcH,
		      float dstX,
		      float dstY,
		      float dstW, float dstH, struct xa_surface *srf[])
{
    float s0, t0, s1, t1;
    float spt0[2], spt1[2];
    struct pipe_resource *tex;

    spt0[0] = srcX;
    spt0[1] = srcY;
    spt1[0] = srcX + srcW;
    spt1[1] = srcY + srcH;

    tex = srf[0]->tex;
    s0 = spt0[0] / tex->width0;
    t0 = spt0[1] / tex->height0;
    s1 = spt1[0] / tex->width0;
    t1 = spt1[1] / tex->height0;

    /* 1st vertex */
    add_vertex_1tex(r, dstX, dstY, s0, t0);
    /* 2nd vertex */
    add_vertex_1tex(r, dstX + dstW, dstY, s1, t0);
    /* 3rd vertex */
    add_vertex_1tex(r, dstX + dstW, dstY + dstH, s1, t1);
    /* 4th vertex */
    add_vertex_1tex(r, dstX, dstY + dstH, s0, t1);

    return renderer_buffer_create(r);
}