|
Navigation
- Home
- Community
- Development
- myReactOS
- Fundraiser 2012
Doxygen
- Main Page
- Alphabetical List
- Data Structures
- Directories
- File List
- Data Fields
- Globals
- Related Pages
Search
|
|
|
Definition at line 68 of file s_linetemp.h.
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
GLuint interpFlags = 0;
GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1];
GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1];
GLint dx, dy;
GLint numPixels;
GLint xstep, ystep;
#if defined(DEPTH_TYPE)
const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0;
struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
#define FixedToDepth(F) ((F) >> fixedToDepthShift)
GLint zPtrXstep, zPtrYstep;
DEPTH_TYPE *zPtr;
#elif defined(INTERP_Z)
const GLint depthBits = ctx->DrawBuffer->Visual.depthBits;
#endif
#ifdef PIXEL_ADDRESS
PIXEL_TYPE *pixelPtr;
GLint pixelXstep, pixelYstep;
#endif
#ifdef SETUP_CODE
SETUP_CODE
#endif
(void) swrast;
{
GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1]
+ vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1];
if (IS_INF_OR_NAN(tmp))
return;
}
#ifdef CLIP_HACK
{
GLint w = ctx->DrawBuffer->Width;
GLint h = ctx->DrawBuffer->Height;
if ((x0==w) | (x1==w)) {
if ((x0==w) & (x1==w))
return;
x0 -= x0==w;
x1 -= x1==w;
}
if ((y0==h) | (y1==h)) {
if ((y0==h) & (y1==h))
return;
y0 -= y0==h;
y1 -= y1==h;
}
}
#endif
dx = x1 - x0;
dy = y1 - y0;
if (dx == 0 && dy == 0)
return;
#ifdef DEPTH_TYPE
zPtr = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, x0, y0);
#endif
#ifdef PIXEL_ADDRESS
pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0);
#endif
if (dx<0) {
dx = -dx;
xstep = -1;
#ifdef DEPTH_TYPE
zPtrXstep = -((GLint)sizeof(DEPTH_TYPE));
#endif
#ifdef PIXEL_ADDRESS
pixelXstep = -((GLint)sizeof(PIXEL_TYPE));
#endif
}
else {
xstep = 1;
#ifdef DEPTH_TYPE
zPtrXstep = ((GLint)sizeof(DEPTH_TYPE));
#endif
#ifdef PIXEL_ADDRESS
pixelXstep = ((GLint)sizeof(PIXEL_TYPE));
#endif
}
if (dy<0) {
dy = -dy;
ystep = -1;
#ifdef DEPTH_TYPE
zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)));
#endif
#ifdef PIXEL_ADDRESS
pixelYstep = BYTES_PER_ROW;
#endif
}
else {
ystep = 1;
#ifdef DEPTH_TYPE
zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE));
#endif
#ifdef PIXEL_ADDRESS
pixelYstep = -(BYTES_PER_ROW);
#endif
}
ASSERT(dx >= 0);
ASSERT(dy >= 0);
numPixels = MAX2(dx, dy);
#ifdef INTERP_RGBA
interpFlags |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
span.red = ChanToFixed(vert0->color[0]);
span.green = ChanToFixed(vert0->color[1]);
span.blue = ChanToFixed(vert0->color[2]);
span.alpha = ChanToFixed(vert0->color[3]);
span.redStep = (ChanToFixed(vert1->color[0]) - span.red ) / numPixels;
span.greenStep = (ChanToFixed(vert1->color[1]) - span.green) / numPixels;
span.blueStep = (ChanToFixed(vert1->color[2]) - span.blue ) / numPixels;
span.alphaStep = (ChanToFixed(vert1->color[3]) - span.alpha) / numPixels;
}
else {
span.red = ChanToFixed(vert1->color[0]);
span.green = ChanToFixed(vert1->color[1]);
span.blue = ChanToFixed(vert1->color[2]);
span.alpha = ChanToFixed(vert1->color[3]);
span.redStep = 0;
span.greenStep = 0;
span.blueStep = 0;
span.alphaStep = 0;
}
#endif
#ifdef INTERP_INDEX
interpFlags |= SPAN_INDEX;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
span.index = FloatToFixed(vert0->attrib[FRAG_ATTRIB_CI][0]);
span.indexStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_CI][0]
- vert0->attrib[FRAG_ATTRIB_CI][0]) / numPixels;
}
else {
span.index = FloatToFixed(vert1->attrib[FRAG_ATTRIB_CI][0]);
span.indexStep = 0;
}
#endif
#if defined(INTERP_Z) || defined(DEPTH_TYPE)
interpFlags |= SPAN_Z;
{
if (depthBits <= 16) {
span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF;
span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2]
- vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels;
}
else {
span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2];
span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2]
- vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels);
}
}
#endif
#if defined(INTERP_ATTRIBS)
{
const GLfloat invLen = 1.0F / numPixels;
const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3];
const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3];
span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0;
span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen;
span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0;
ATTRIB_LOOP_BEGIN
if (swrast->_InterpMode[attr] == GL_FLAT) {
COPY_4V(span.attrStart[attr], vert1->attrib[attr]);
ASSIGN_4V(span.attrStepX[attr], 0.0, 0.0, 0.0, 0.0);
}
else {
GLuint c;
for (c = 0; c < 4; c++) {
float da;
span.attrStart[attr][c] = invw0 * vert0->attrib[attr][c];
da = (invw1 * vert1->attrib[attr][c]) - span.attrStart[attr][c];
span.attrStepX[attr][c] = da * invLen;
}
}
ASSIGN_4V(span.attrStepY[attr], 0.0, 0.0, 0.0, 0.0);
ATTRIB_LOOP_END
}
#endif
INIT_SPAN(span, GL_LINE);
span.end = numPixels;
span.interpMask = interpFlags;
span.arrayMask = SPAN_XY;
span.facing = swrast->PointLineFacing;
if (dx > dy) {
GLint i;
GLint errorInc = dy+dy;
GLint error = errorInc-dx;
GLint errorDec = error-dx;
for (i = 0; i < dx; i++) {
#ifdef DEPTH_TYPE
GLuint Z = FixedToDepth(span.z);
#endif
#ifdef PLOT
PLOT( x0, y0 );
#else
span.array->x[i] = x0;
span.array->y[i] = y0;
#endif
x0 += xstep;
#ifdef DEPTH_TYPE
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
span.z += span.zStep;
#endif
#ifdef PIXEL_ADDRESS
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep);
#endif
if (error < 0) {
error += errorInc;
}
else {
error += errorDec;
y0 += ystep;
#ifdef DEPTH_TYPE
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
#endif
#ifdef PIXEL_ADDRESS
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep);
#endif
}
}
}
else {
GLint i;
GLint errorInc = dx+dx;
GLint error = errorInc-dy;
GLint errorDec = error-dy;
for (i=0;i<dy;i++) {
#ifdef DEPTH_TYPE
GLuint Z = FixedToDepth(span.z);
#endif
#ifdef PLOT
PLOT( x0, y0 );
#else
span.array->x[i] = x0;
span.array->y[i] = y0;
#endif
y0 += ystep;
#ifdef DEPTH_TYPE
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep);
span.z += span.zStep;
#endif
#ifdef PIXEL_ADDRESS
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep);
#endif
if (error<0) {
error += errorInc;
}
else {
error += errorDec;
x0 += xstep;
#ifdef DEPTH_TYPE
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep);
#endif
#ifdef PIXEL_ADDRESS
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep);
#endif
}
}
}
#ifdef RENDER_SPAN
RENDER_SPAN( span );
#endif
(void)span;
}
|
Generated on Fri May 25 2012 04:58:07 for ReactOS by
1.7.6.1
|