コード例 #1
0
struct draw_stage *draw_wide_point_stage( struct draw_context *draw )
{
   struct widepoint_stage *wide = CALLOC_STRUCT(widepoint_stage);
   if (wide == NULL)
      goto fail;

   if (!draw_alloc_temp_verts( &wide->stage, 4 ))
      goto fail;

   wide->stage.draw = draw;
   wide->stage.next = NULL;
   wide->stage.point = widepoint_first_point;
   wide->stage.line = draw_pipe_passthrough_line;
   wide->stage.tri = draw_pipe_passthrough_tri;
   wide->stage.flush = widepoint_flush;
   wide->stage.reset_stipple_counter = widepoint_reset_stipple_counter;
   wide->stage.destroy = widepoint_destroy;

   return &wide->stage;

 fail:
   if (wide)
      wide->stage.destroy( &wide->stage );
   
   return NULL;
}
コード例 #2
0
static struct aapoint_stage *
draw_aapoint_stage(struct draw_context *draw)
{
   struct aapoint_stage *aapoint = CALLOC_STRUCT(aapoint_stage);
   if (aapoint == NULL)
      goto fail;

   aapoint->stage.draw = draw;
   aapoint->stage.name = "aapoint";
   aapoint->stage.next = NULL;
   aapoint->stage.point = aapoint_first_point;
   aapoint->stage.line = draw_pipe_passthrough_line;
   aapoint->stage.tri = draw_pipe_passthrough_tri;
   aapoint->stage.flush = aapoint_flush;
   aapoint->stage.reset_stipple_counter = aapoint_reset_stipple_counter;
   aapoint->stage.destroy = aapoint_destroy;

   if (!draw_alloc_temp_verts( &aapoint->stage, 4 ))
      goto fail;

   return aapoint;

 fail:
   if (aapoint)
      aapoint->stage.destroy(&aapoint->stage);

   return NULL;

}
コード例 #3
0
/**
 * Allocate a new clipper stage.
 * \return pointer to new stage object
 */
struct draw_stage *draw_clip_stage( struct draw_context *draw )
{
   struct clip_stage *clipper = CALLOC_STRUCT(clip_stage);
   if (clipper == NULL)
      goto fail;

   clipper->stage.draw = draw;
   clipper->stage.name = "clipper";
   clipper->stage.point = clip_point;
   clipper->stage.line = clip_first_line;
   clipper->stage.tri = clip_first_tri;
   clipper->stage.flush = clip_flush;
   clipper->stage.reset_stipple_counter = clip_reset_stipple_counter;
   clipper->stage.destroy = clip_destroy;

   clipper->plane = draw->plane;

   if (!draw_alloc_temp_verts( &clipper->stage, MAX_CLIPPED_VERTICES+1 ))
      goto fail;

   return &clipper->stage;

 fail:
   if (clipper)
      clipper->stage.destroy( &clipper->stage );

   return NULL;
}
コード例 #4
0
/** Create a new polygon stipple drawing stage object */
static struct pstip_stage *
draw_pstip_stage(struct draw_context *draw, struct pipe_context *pipe)
{
   struct pstip_stage *pstip = CALLOC_STRUCT(pstip_stage);
   if (!pstip)
      goto fail;

   pstip->pipe = pipe;

   pstip->stage.draw = draw;
   pstip->stage.name = "pstip";
   pstip->stage.next = NULL;
   pstip->stage.point = draw_pipe_passthrough_point;
   pstip->stage.line = draw_pipe_passthrough_line;
   pstip->stage.tri = pstip_first_tri;
   pstip->stage.flush = pstip_flush;
   pstip->stage.reset_stipple_counter = pstip_reset_stipple_counter;
   pstip->stage.destroy = pstip_destroy;

   if (!draw_alloc_temp_verts( &pstip->stage, 8 ))
      goto fail;

   return pstip;

fail:
   if (pstip)
      pstip->stage.destroy( &pstip->stage );

   return NULL;
}
コード例 #5
0
/**
 * Create line stippler stage
 */
struct draw_stage *draw_stipple_stage( struct draw_context *draw )
{
   struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage);

   draw_alloc_temp_verts( &stipple->stage, 2 );

   stipple->stage.draw = draw;
   stipple->stage.next = NULL;
   stipple->stage.point = stipple_reset_point;
   stipple->stage.line = stipple_first_line;
   stipple->stage.tri = stipple_reset_tri;
   stipple->stage.reset_stipple_counter = reset_stipple_counter;
   stipple->stage.flush = stipple_flush;
   stipple->stage.destroy = stipple_destroy;

   return &stipple->stage;
}
コード例 #6
0
struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
{
   struct wideline_stage *wide = CALLOC_STRUCT(wideline_stage);

   draw_alloc_temp_verts( &wide->stage, 4 );

   wide->stage.draw = draw;
   wide->stage.name = "wide-line";
   wide->stage.next = NULL;
   wide->stage.point = draw_pipe_passthrough_point;
   wide->stage.line = wideline_first_line;
   wide->stage.tri = draw_pipe_passthrough_tri;
   wide->stage.flush = wideline_flush;
   wide->stage.reset_stipple_counter = wideline_reset_stipple_counter;
   wide->stage.destroy = wideline_destroy;

   return &wide->stage;
}