1 /* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */
3 #include "spantmp_common.h"
9 static void TAG(WriteStencilSpan
)( GLcontext
*ctx
,
10 struct gl_renderbuffer
*rb
,
11 GLuint n
, GLint x
, GLint y
,
12 const void *values
, const GLubyte mask
[] )
16 const GLubyte
*stencil
= (const GLubyte
*) values
;
26 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
28 if (DBG
) fprintf(stderr
, "WriteStencilSpan %d..%d (x1 %d)\n",
29 (int)i
, (int)n1
, (int)x1
);
33 for (;n1
>0;i
++,x1
++,n1
--)
35 WRITE_STENCIL( x1
, y
, stencil
[i
] );
39 for (;n1
>0;i
++,x1
++,n1
--)
40 WRITE_STENCIL( x1
, y
, stencil
[i
] );
49 static void TAG(WriteMonoStencilSpan
)( GLcontext
*ctx
,
50 struct gl_renderbuffer
*rb
,
51 GLuint n
, GLint x
, GLint y
,
53 const GLubyte mask
[] )
57 const GLubyte stencil
= *((const GLubyte
*) value
);
67 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
69 if (DBG
) fprintf(stderr
, "WriteStencilSpan %d..%d (x1 %d)\n",
70 (int)i
, (int)n1
, (int)x1
);
74 for (;n1
>0;i
++,x1
++,n1
--)
76 WRITE_STENCIL( x1
, y
, stencil
);
80 for (;n1
>0;i
++,x1
++,n1
--)
81 WRITE_STENCIL( x1
, y
, stencil
);
91 static void TAG(WriteStencilPixels
)( GLcontext
*ctx
,
92 struct gl_renderbuffer
*rb
,
94 const GLint x
[], const GLint y
[],
95 const void *values
, const GLubyte mask
[] )
99 const GLubyte
*stencil
= (const GLubyte
*) values
;
103 if (DBG
) fprintf(stderr
, "WriteStencilPixels\n");
110 const int fy
= Y_FLIP(y
[i
]);
111 if (CLIPPIXEL(x
[i
],fy
))
112 WRITE_STENCIL( x
[i
], fy
, stencil
[i
] );
122 /* Read stencil spans and pixels
124 static void TAG(ReadStencilSpan
)( GLcontext
*ctx
,
125 struct gl_renderbuffer
*rb
,
126 GLuint n
, GLint x
, GLint y
,
131 GLubyte
*stencil
= (GLubyte
*) values
;
137 if (DBG
) fprintf(stderr
, "ReadStencilSpan\n");
142 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
144 READ_STENCIL( stencil
[i
], (x
+i
), y
);
151 static void TAG(ReadStencilPixels
)( GLcontext
*ctx
,
152 struct gl_renderbuffer
*rb
,
153 GLuint n
, const GLint x
[], const GLint y
[],
158 GLubyte
*stencil
= (GLubyte
*) values
;
162 if (DBG
) fprintf(stderr
, "ReadStencilPixels\n");
167 int fy
= Y_FLIP( y
[i
] );
168 if (CLIPPIXEL( x
[i
], fy
))
169 READ_STENCIL( stencil
[i
], x
[i
], fy
);