use structure containment to derive xmesa_context from GLcontext
[mesa.git] / src / mesa / drivers / x11 / xm_line.c
1 /* $Id: xm_line.c,v 1.24 2003/04/01 17:28:12 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 5.1
6 *
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 /*
29 * This file contains "accelerated" point, line, and triangle functions.
30 * It should be fairly easy to write new special-purpose point, line or
31 * triangle functions and hook them into this module.
32 */
33
34
35 #include "glxheader.h"
36 #include "depth.h"
37 #include "macros.h"
38 #include "mtypes.h"
39 #include "xmesaP.h"
40
41 /* Internal swrast includes:
42 */
43 #include "swrast/s_depth.h"
44 #include "swrast/s_points.h"
45 #include "swrast/s_lines.h"
46 #include "swrast/s_context.h"
47
48
49 /**********************************************************************/
50 /*** Point rendering ***/
51 /**********************************************************************/
52
53
54 /*
55 * Render an array of points into a pixmap, any pixel format.
56 */
57 #if 000
58 /* XXX don't use this, it doesn't dither correctly */
59 static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
60 {
61 XMesaContext xmesa = XMESA_CONTEXT(ctx);
62 XMesaDisplay *dpy = xmesa->xm_visual->display;
63 XMesaDrawable buffer = xmesa->xm_buffer->buffer;
64 XMesaGC gc = xmesa->xm_buffer->gc;
65
66 if (xmesa->xm_visual->mesa_visual.RGBAflag) {
67 register int x, y;
68 const GLubyte *color = vert->color;
69 unsigned long pixel = xmesa_color_to_pixel( xmesa,
70 color[0], color[1],
71 color[2], color[3],
72 xmesa->pixelformat);
73 XMesaSetForeground( dpy, gc, pixel );
74 x = (GLint) vert->win[0];
75 y = FLIP( xmesa->xm_buffer, (GLint) vert->win[1] );
76 XMesaDrawPoint( dpy, buffer, gc, x, y);
77 }
78 else {
79 /* Color index mode */
80 register int x, y;
81 XMesaSetForeground( dpy, gc, vert->index );
82 x = (GLint) vert->win[0];
83 y = FLIP( xmesa->xm_buffer, (GLint) vert->win[1] );
84 XMesaDrawPoint( dpy, buffer, gc, x, y);
85 }
86 }
87 #endif
88
89
90 /* Override the swrast point-selection function. Try to use one of
91 * our internal point functions, otherwise fall back to the standard
92 * swrast functions.
93 */
94 void xmesa_choose_point( GLcontext *ctx )
95 {
96 #if 0
97 XMesaContext xmesa = XMESA_CONTEXT(ctx);
98 SWcontext *swrast = SWRAST_CONTEXT(ctx);
99
100 if (ctx->RenderMode == GL_RENDER
101 && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag
102 && swrast->_RasterMask == 0
103 && !ctx->Texture._EnabledUnits
104 && xmesa->xm_buffer->buffer != XIMAGE) {
105 swrast->Point = draw_points_ANY_pixmap;
106 }
107 else {
108 _swrast_choose_point( ctx );
109 }
110 #else
111 _swrast_choose_point( ctx );
112 #endif
113 }
114
115
116
117 /**********************************************************************/
118 /*** Line rendering ***/
119 /**********************************************************************/
120
121
122 /*
123 * Draw a flat-shaded, PF_TRUECOLOR line into an XImage.
124 */
125 #define NAME flat_TRUECOLOR_line
126 #define SETUP_CODE \
127 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
128 const GLubyte *color = vert1->color; \
129 XMesaImage *img = xmesa->xm_buffer->backimage; \
130 unsigned long pixel; \
131 PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
132 #define CLIP_HACK 1
133 #define PLOT(X,Y) XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel );
134 #include "swrast/s_linetemp.h"
135
136
137
138 /*
139 * Draw a flat-shaded, PF_8A8B8G8R line into an XImage.
140 */
141 #define NAME flat_8A8B8G8R_line
142 #define SETUP_CODE \
143 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
144 const GLubyte *color = vert1->color; \
145 GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
146 #define PIXEL_TYPE GLuint
147 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
148 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
149 #define CLIP_HACK 1
150 #define PLOT(X,Y) *pixelPtr = pixel;
151 #include "swrast/s_linetemp.h"
152
153
154
155 /*
156 * Draw a flat-shaded, PF_8R8G8B line into an XImage.
157 */
158 #define NAME flat_8R8G8B_line
159 #define SETUP_CODE \
160 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
161 const GLubyte *color = vert1->color; \
162 GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
163 #define PIXEL_TYPE GLuint
164 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
165 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
166 #define CLIP_HACK 1
167 #define PLOT(X,Y) *pixelPtr = pixel;
168 #include "swrast/s_linetemp.h"
169
170
171
172 /*
173 * Draw a flat-shaded, PF_8R8G8B24 line into an XImage.
174 */
175 #define NAME flat_8R8G8B24_line
176 #define SETUP_CODE \
177 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
178 const GLubyte *color = vert1->color;
179 #define PIXEL_TYPE bgr_t
180 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
181 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
182 #define CLIP_HACK 1
183 #define PLOT(X,Y) { \
184 pixelPtr->r = color[RCOMP]; \
185 pixelPtr->g = color[GCOMP]; \
186 pixelPtr->b = color[BCOMP]; \
187 }
188 #include "swrast/s_linetemp.h"
189
190
191
192 /*
193 * Draw a flat-shaded, PF_5R6G5B line into an XImage.
194 */
195 #define NAME flat_5R6G5B_line
196 #define SETUP_CODE \
197 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
198 const GLubyte *color = vert1->color; \
199 GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
200 #define PIXEL_TYPE GLushort
201 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
202 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
203 #define CLIP_HACK 1
204 #define PLOT(X,Y) *pixelPtr = pixel;
205 #include "swrast/s_linetemp.h"
206
207
208
209 /*
210 * Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage.
211 */
212 #define NAME flat_DITHER_5R6G5B_line
213 #define SETUP_CODE \
214 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
215 const GLubyte *color = vert1->color;
216 #define PIXEL_TYPE GLushort
217 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
218 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
219 #define CLIP_HACK 1
220 #define PLOT(X,Y) PACK_TRUEDITHER( *pixelPtr, X, Y, color[0], color[1], color[2] );
221 #include "swrast/s_linetemp.h"
222
223
224
225
226 /*
227 * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage.
228 */
229 #define NAME flat_DITHER8_line
230 #define SETUP_CODE \
231 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
232 const GLubyte *color = vert1->color; \
233 GLint r = color[0], g = color[1], b = color[2]; \
234 DITHER_SETUP;
235 #define PIXEL_TYPE GLubyte
236 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
237 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
238 #define CLIP_HACK 1
239 #define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b);
240 #include "swrast/s_linetemp.h"
241
242
243
244 /*
245 * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage.
246 */
247 #define NAME flat_LOOKUP8_line
248 #define SETUP_CODE \
249 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
250 const GLubyte *color = vert1->color; \
251 GLubyte pixel; \
252 LOOKUP_SETUP; \
253 pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
254 #define PIXEL_TYPE GLubyte
255 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
256 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
257 #define CLIP_HACK 1
258 #define PLOT(X,Y) *pixelPtr = pixel;
259 #include "swrast/s_linetemp.h"
260
261
262
263 /*
264 * Draw a flat-shaded, PF_HPCR line into an XImage.
265 */
266 #define NAME flat_HPCR_line
267 #define SETUP_CODE \
268 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
269 const GLubyte *color = vert1->color; \
270 GLint r = color[0], g = color[1], b = color[2];
271 #define PIXEL_TYPE GLubyte
272 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
273 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
274 #define CLIP_HACK 1
275 #define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b);
276 #include "swrast/s_linetemp.h"
277
278
279
280
281 /*
282 * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage.
283 */
284 #define NAME flat_TRUECOLOR_z_line
285 #define SETUP_CODE \
286 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
287 const GLubyte *color = vert1->color; \
288 XMesaImage *img = xmesa->xm_buffer->backimage; \
289 unsigned long pixel; \
290 PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
291 #define INTERP_Z 1
292 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
293 #define CLIP_HACK 1
294 #define PLOT(X,Y) \
295 if (Z < *zPtr) { \
296 *zPtr = Z; \
297 XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel ); \
298 }
299 #include "swrast/s_linetemp.h"
300
301
302
303 /*
304 * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage.
305 */
306 #define NAME flat_8A8B8G8R_z_line
307 #define SETUP_CODE \
308 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
309 const GLubyte *color = vert1->color; \
310 GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
311 #define INTERP_Z 1
312 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
313 #define PIXEL_TYPE GLuint
314 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
315 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
316 #define CLIP_HACK 1
317 #define PLOT(X,Y) \
318 if (Z < *zPtr) { \
319 *zPtr = Z; \
320 *pixelPtr = pixel; \
321 }
322 #include "swrast/s_linetemp.h"
323
324
325
326 /*
327 * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage.
328 */
329 #define NAME flat_8R8G8B_z_line
330 #define SETUP_CODE \
331 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
332 const GLubyte *color = vert1->color; \
333 GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
334 #define INTERP_Z 1
335 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
336 #define PIXEL_TYPE GLuint
337 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
338 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
339 #define CLIP_HACK 1
340 #define PLOT(X,Y) \
341 if (Z < *zPtr) { \
342 *zPtr = Z; \
343 *pixelPtr = pixel; \
344 }
345 #include "swrast/s_linetemp.h"
346
347
348
349 /*
350 * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage.
351 */
352 #define NAME flat_8R8G8B24_z_line
353 #define SETUP_CODE \
354 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
355 const GLubyte *color = vert1->color;
356 #define INTERP_Z 1
357 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
358 #define PIXEL_TYPE bgr_t
359 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
360 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
361 #define CLIP_HACK 1
362 #define PLOT(X,Y) \
363 if (Z < *zPtr) { \
364 *zPtr = Z; \
365 pixelPtr->r = color[RCOMP]; \
366 pixelPtr->g = color[GCOMP]; \
367 pixelPtr->b = color[BCOMP]; \
368 }
369 #include "swrast/s_linetemp.h"
370
371
372
373 /*
374 * Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage.
375 */
376 #define NAME flat_5R6G5B_z_line
377 #define SETUP_CODE \
378 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
379 const GLubyte *color = vert1->color; \
380 GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
381 #define INTERP_Z 1
382 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
383 #define PIXEL_TYPE GLushort
384 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
385 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
386 #define CLIP_HACK 1
387 #define PLOT(X,Y) \
388 if (Z < *zPtr) { \
389 *zPtr = Z; \
390 *pixelPtr = pixel; \
391 }
392 #include "swrast/s_linetemp.h"
393
394
395
396 /*
397 * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage.
398 */
399 #define NAME flat_DITHER_5R6G5B_z_line
400 #define SETUP_CODE \
401 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
402 const GLubyte *color = vert1->color;
403 #define INTERP_Z 1
404 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
405 #define PIXEL_TYPE GLushort
406 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
407 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
408 #define CLIP_HACK 1
409 #define PLOT(X,Y) \
410 if (Z < *zPtr) { \
411 *zPtr = Z; \
412 PACK_TRUEDITHER(*pixelPtr, X, Y, color[0], color[1], color[2]); \
413 }
414 #include "swrast/s_linetemp.h"
415
416
417
418 /*
419 * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage.
420 */
421 #define NAME flat_DITHER8_z_line
422 #define SETUP_CODE \
423 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
424 const GLubyte *color = vert1->color; \
425 GLint r = color[0], g = color[1], b = color[2]; \
426 DITHER_SETUP;
427 #define INTERP_Z 1
428 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
429 #define PIXEL_TYPE GLubyte
430 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
431 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
432 #define CLIP_HACK 1
433 #define PLOT(X,Y) \
434 if (Z < *zPtr) { \
435 *zPtr = Z; \
436 *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b); \
437 }
438 #include "swrast/s_linetemp.h"
439
440
441
442 /*
443 * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage.
444 */
445 #define NAME flat_LOOKUP8_z_line
446 #define SETUP_CODE \
447 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
448 const GLubyte *color = vert1->color; \
449 GLubyte pixel; \
450 LOOKUP_SETUP; \
451 pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
452 #define INTERP_Z 1
453 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
454 #define PIXEL_TYPE GLubyte
455 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
456 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
457 #define CLIP_HACK 1
458 #define PLOT(X,Y) \
459 if (Z < *zPtr) { \
460 *zPtr = Z; \
461 *pixelPtr = pixel; \
462 }
463 #include "swrast/s_linetemp.h"
464
465
466
467 /*
468 * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage.
469 */
470 #define NAME flat_HPCR_z_line
471 #define SETUP_CODE \
472 XMesaContext xmesa = XMESA_CONTEXT(ctx); \
473 const GLubyte *color = vert1->color; \
474 GLint r = color[0], g = color[1], b = color[2];
475 #define INTERP_Z 1
476 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
477 #define PIXEL_TYPE GLubyte
478 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
479 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
480 #define CLIP_HACK 1
481 #define PLOT(X,Y) \
482 if (Z < *zPtr) { \
483 *zPtr = Z; \
484 *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \
485 }
486 #include "swrast/s_linetemp.h"
487
488
489
490 static swrast_line_func get_line_func( GLcontext *ctx )
491 {
492 XMesaContext xmesa = XMESA_CONTEXT(ctx);
493 SWcontext *swrast = SWRAST_CONTEXT(ctx);
494 int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
495
496 (void) DitherValues; /* silence unused var warning */
497 (void) kernel1; /* silence unused var warning */
498
499 if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
500 if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
501 if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL;
502 if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL;
503 if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
504 if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
505
506 if (xmesa->xm_buffer->buffer==XIMAGE
507 && swrast->_RasterMask==DEPTH_BIT
508 && ctx->Depth.Func==GL_LESS
509 && ctx->Depth.Mask==GL_TRUE
510 && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS
511 && ctx->Line.Width==1.0F) {
512 switch (xmesa->pixelformat) {
513 case PF_Truecolor:
514 return flat_TRUECOLOR_z_line;
515 case PF_8A8B8G8R:
516 return flat_8A8B8G8R_z_line;
517 case PF_8R8G8B:
518 return flat_8R8G8B_z_line;
519 case PF_8R8G8B24:
520 return flat_8R8G8B24_z_line;
521 case PF_5R6G5B:
522 return flat_5R6G5B_z_line;
523 case PF_Dither_5R6G5B:
524 return flat_DITHER_5R6G5B_z_line;
525 case PF_Dither:
526 return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL;
527 case PF_Lookup:
528 return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL;
529 case PF_HPCR:
530 return flat_HPCR_z_line;
531 default:
532 return (swrast_line_func)NULL;
533 }
534 }
535 if (xmesa->xm_buffer->buffer==XIMAGE
536 && swrast->_RasterMask==0
537 && ctx->Line.Width==1.0F) {
538 switch (xmesa->pixelformat) {
539 case PF_Truecolor:
540 return flat_TRUECOLOR_line;
541 case PF_8A8B8G8R:
542 return flat_8A8B8G8R_line;
543 case PF_8R8G8B:
544 return flat_8R8G8B_line;
545 case PF_8R8G8B24:
546 return flat_8R8G8B24_line;
547 case PF_5R6G5B:
548 return flat_5R6G5B_line;
549 case PF_Dither_5R6G5B:
550 return flat_DITHER_5R6G5B_line;
551 case PF_Dither:
552 return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL;
553 case PF_Lookup:
554 return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL;
555 case PF_HPCR:
556 return flat_HPCR_line;
557 default:
558 return (swrast_line_func)NULL;
559 }
560 }
561
562 return (swrast_line_func) NULL;
563 }
564
565 /* Override for the swrast line-selection function. Try to use one
566 * of our internal line functions, otherwise fall back to the
567 * standard swrast functions.
568 */
569 void xmesa_choose_line( GLcontext *ctx )
570 {
571 SWcontext *swrast = SWRAST_CONTEXT(ctx);
572
573 if (!(swrast->Line = get_line_func( ctx )))
574 _swrast_choose_line( ctx );
575 }