Example #1
0
void renderer_texture(struct xorg_renderer *r,
                      int *pos,
                      int width, int height,
                      struct pipe_texture **textures,
                      int num_textures,
                      float *src_matrix,
                      float *mask_matrix)
{

#if 0
   if (src_matrix) {
      debug_printf("src_matrix = \n");
      debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]);
      debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]);
      debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]);
   }
   if (mask_matrix) {
      debug_printf("mask_matrix = \n");
      debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]);
      debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]);
      debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]);
   }
#endif

   switch(r->attrs_per_vertex) {
   case 2:
      renderer_draw_conditional(r, 4 * 8);
      add_vertex_data1(r,
                       pos[0], pos[1], /* src */
                       pos[4], pos[5], /* dst */
                       width, height,
                       textures[0], src_matrix);
      break;
   case 3:
      renderer_draw_conditional(r, 4 * 12);
      add_vertex_data2(r,
                       pos[0], pos[1], /* src */
                       pos[2], pos[3], /* mask */
                       pos[4], pos[5], /* dst */
                       width, height,
                       textures[0], textures[1],
                       src_matrix, mask_matrix);
      break;
   default:
      debug_assert(!"Unsupported number of textures");
      break;
   }
}
Example #2
0
void
renderer_copy(struct xa_context *r,
	      int dx,
	      int dy,
	      int sx,
	      int sy,
	      int width, int height, float src_width, float src_height)
{
    float s0, t0, s1, t1;
    float x0, y0, x1, y1;

    /* XXX: could put the texcoord scaling calculation into the vertex
     * shader.
     */
    s0 = sx / src_width;
    s1 = (sx + width) / src_width;
    t0 = sy / src_height;
    t1 = (sy + height) / src_height;

    x0 = dx;
    x1 = dx + width;
    y0 = dy;
    y1 = dy + height;

    /* draw quad */
    renderer_draw_conditional(r, 4 * 8);
    add_vertex_1tex(r, x0, y0, s0, t0);
    add_vertex_1tex(r, x1, y0, s1, t0);
    add_vertex_1tex(r, x1, y1, s1, t1);
    add_vertex_1tex(r, x0, y1, s0, t1);
}
Example #3
0
void
renderer_texture(struct xa_context *r,
		 int *pos,
		 int width, int height,
		 const float *src_matrix,
		 const float *mask_matrix)
{
    struct pipe_sampler_view **sampler_view = r->bound_sampler_views;

#if 0
    if (src_matrix) {
	debug_printf("src_matrix = \n");
	debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]);
	debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]);
	debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]);
    }
    if (mask_matrix) {
	debug_printf("mask_matrix = \n");
	debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]);
	debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]);
	debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]);
    }
#endif

    switch(r->attrs_per_vertex) {
    case 2:
	renderer_draw_conditional(r, 4 * 8);
	add_vertex_data1(r,
			 pos[0], pos[1], /* src */
			 pos[4], pos[5], /* dst */
			 width, height,
			 sampler_view[0]->texture, src_matrix);
	break;
    case 3:
	renderer_draw_conditional(r, 4 * 12);
	add_vertex_data2(r,
			 pos[0], pos[1], /* src */
			 pos[2], pos[3], /* mask */
			 pos[4], pos[5], /* dst */
			 width, height,
			 sampler_view[0]->texture, sampler_view[1]->texture,
			 src_matrix, mask_matrix);
	break;
    default:
	break;
    }
}
Example #4
0
void
renderer_solid(struct xa_context *r,
	       int x0, int y0, int x1, int y1, float *color)
{
    /*
     * debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n",
     * x0, y0, x1, y1, color[0], color[1], color[2], color[3]); */

    renderer_draw_conditional(r, 4 * 8);

    /* 1st vertex */
    add_vertex_color(r, x0, y0, color);
    /* 2nd vertex */
    add_vertex_color(r, x1, y0, color);
    /* 3rd vertex */
    add_vertex_color(r, x1, y1, color);
    /* 4th vertex */
    add_vertex_color(r, x0, y1, color);
}
Example #5
0
void
renderer_draw_flush(struct xa_context *r)
{
    renderer_draw_conditional(r, 0);
}
Example #6
0
void renderer_draw_flush(struct xorg_renderer *r)
{
   renderer_draw_conditional(r, 0);
}