示例#1
0
文件: s_logic.c 项目: xSIMx/Mesa-3D
/**
 * Apply the current logic operator to a span of RGBA pixels.
 * We can handle horizontal runs of pixels (spans) or arrays of x/y
 * pixel coordinates.
 */
void
_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
                          SWspan *span)
{
   void *rbPixels;

   ASSERT(span->end < SWRAST_MAX_WIDTH);
   ASSERT(span->arrayMask & SPAN_RGBA);

   rbPixels = _swrast_get_dest_rgba(ctx, rb, span);

   if (span->array->ChanType == GL_UNSIGNED_BYTE) {
      /* treat 4*GLubyte as GLuint */
      logicop_uint1(ctx, span->end,
                    (GLuint *) span->array->rgba8,
                    (const GLuint *) rbPixels, span->array->mask);
   }
   else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
      /* treat 2*GLushort as GLuint */
      logicop_uint2(ctx, 2 * span->end,
                    (GLuint *) span->array->rgba16,
                    (const GLuint *) rbPixels, span->array->mask);
   }
   else {
      logicop_uint4(ctx, 4 * span->end,
                    (GLuint *) span->array->attribs[VARYING_SLOT_COL0],
                    (const GLuint *) rbPixels, span->array->mask);
   }
}
示例#2
0
文件: s_logic.c 项目: Starlink/mesa
/**
 * Apply the current logic operator to a span of RGBA pixels.
 * We can handle horizontal runs of pixels (spans) or arrays of x/y
 * pixel coordinates.
 */
void
_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
                          SWspan *span)
{
   void *rbPixels;

   ASSERT(span->end < MAX_WIDTH);
   ASSERT(span->arrayMask & SPAN_RGBA);
   ASSERT(rb->DataType == span->array->ChanType);

   rbPixels = _swrast_get_dest_rgba(ctx, rb, span);

   if (span->array->ChanType == GL_UNSIGNED_BYTE) {
      /* treat 4*GLubyte as GLuint */
      logicop_uint1(ctx, span->end,
                    (GLuint *) span->array->color.sz1.rgba,
                    (const GLuint *) rbPixels, span->array->mask);
   }
   else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
      /* treat 2*GLushort as GLuint */
      logicop_uint2(ctx, 2 * span->end,
                    (GLuint *) span->array->color.sz2.rgba,
                    (const GLuint *) rbPixels, span->array->mask);
   }
   else {
      logicop_uint4(ctx, 4 * span->end,
                    (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0],
                    (const GLuint *) rbPixels, span->array->mask);
   }
}
/*
 * Apply the current logic operator to a span of CI pixels.  This is only
 * used if the device driver can't do logic ops.
 */
void
_swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
                        SWspan *span)
{
   GLuint dest[MAX_WIDTH];
   GLuint *index = span->array->index;

   ASSERT(span->end < MAX_WIDTH);
   ASSERT(rb->DataType == GL_UNSIGNED_INT);

   /* Read dest values from frame buffer */
   if (span->arrayMask & SPAN_XY) {
      _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y,
                         dest, sizeof(GLuint));
   }
   else {
      rb->GetRow(ctx, rb, span->end, span->x, span->y, dest);
   }

   logicop_uint1(ctx, span->end, index, dest, span->array->mask);
}