1 /* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */
8 #define HW_WRITE_LOCK() HW_LOCK()
10 #ifndef HW_WRITE_UNLOCK
11 #define HW_WRITE_UNLOCK() HW_UNLOCK()
15 #define HW_READ_LOCK() HW_LOCK()
17 #ifndef HW_READ_UNLOCK
18 #define HW_READ_UNLOCK() HW_UNLOCK()
21 static void TAG(WriteStencilSpan
)( GLcontext
*ctx
,
22 struct gl_renderbuffer
*rb
,
23 GLuint n
, GLint x
, GLint y
,
24 const void *values
, const GLubyte mask
[] )
28 const GLubyte
*stencil
= (const GLubyte
*) values
;
38 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
40 if (DBG
) fprintf(stderr
, "WriteStencilSpan %d..%d (x1 %d)\n",
41 (int)i
, (int)n1
, (int)x1
);
45 for (;n1
>0;i
++,x1
++,n1
--)
47 WRITE_STENCIL( x1
, y
, stencil
[i
] );
51 for (;n1
>0;i
++,x1
++,n1
--)
52 WRITE_STENCIL( x1
, y
, stencil
[i
] );
61 static void TAG(WriteMonoStencilSpan
)( GLcontext
*ctx
,
62 struct gl_renderbuffer
*rb
,
63 GLuint n
, GLint x
, GLint y
,
65 const GLubyte mask
[] )
69 const GLubyte stencil
= *((const GLubyte
*) value
);
79 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
81 if (DBG
) fprintf(stderr
, "WriteStencilSpan %d..%d (x1 %d)\n",
82 (int)i
, (int)n1
, (int)x1
);
86 for (;n1
>0;i
++,x1
++,n1
--)
88 WRITE_STENCIL( x1
, y
, stencil
);
92 for (;n1
>0;i
++,x1
++,n1
--)
93 WRITE_STENCIL( x1
, y
, stencil
);
103 static void TAG(WriteStencilPixels
)( GLcontext
*ctx
,
104 struct gl_renderbuffer
*rb
,
106 const GLint x
[], const GLint y
[],
107 const void *values
, const GLubyte mask
[] )
111 const GLubyte
*stencil
= (const GLubyte
*) values
;
115 if (DBG
) fprintf(stderr
, "WriteStencilPixels\n");
122 const int fy
= Y_FLIP(y
[i
]);
123 if (CLIPPIXEL(x
[i
],fy
))
124 WRITE_STENCIL( x
[i
], fy
, stencil
[i
] );
134 /* Read stencil spans and pixels
136 static void TAG(ReadStencilSpan
)( GLcontext
*ctx
,
137 struct gl_renderbuffer
*rb
,
138 GLuint n
, GLint x
, GLint y
,
143 GLubyte
*stencil
= (GLubyte
*) values
;
149 if (DBG
) fprintf(stderr
, "ReadStencilSpan\n");
154 CLIPSPAN(x
,y
,n
,x1
,n1
,i
);
156 READ_STENCIL( stencil
[i
], (x
+i
), y
);
163 static void TAG(ReadStencilPixels
)( GLcontext
*ctx
,
164 struct gl_renderbuffer
*rb
,
165 GLuint n
, const GLint x
[], const GLint y
[],
170 GLubyte
*stencil
= (GLubyte
*) values
;
174 if (DBG
) fprintf(stderr
, "ReadStencilPixels\n");
179 int fy
= Y_FLIP( y
[i
] );
180 if (CLIPPIXEL( x
[i
], fy
))
181 READ_STENCIL( stencil
[i
], x
[i
], fy
);