1 /* $Id: xm_line.c,v 1.1 2000/09/07 15:40:30 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
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.
35 #include "glxheader.h"
44 /**********************************************************************/
45 /*** Point rendering ***/
46 /**********************************************************************/
50 * Render an array of points into a pixmap, any pixel format.
52 static void draw_points_ANY_pixmap( GLcontext
*ctx
, GLuint first
, GLuint last
)
54 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
55 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
56 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
57 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
58 struct vertex_buffer
*VB
= ctx
->VB
;
61 if (xmesa
->xm_visual
->gl_visual
->RGBAflag
) {
63 for (i
=first
;i
<=last
;i
++) {
64 if (VB
->ClipMask
[i
]==0) {
66 const GLubyte
*color
= VB
->ColorPtr
->data
[i
];
67 unsigned long pixel
= xmesa_color_to_pixel( xmesa
,
68 color
[0], color
[1], color
[2], color
[3], xmesa
->pixelformat
);
69 XMesaSetForeground( dpy
, gc
, pixel
);
70 x
= (GLint
) VB
->Win
.data
[i
][0];
71 y
= FLIP( xmesa
->xm_buffer
, (GLint
) VB
->Win
.data
[i
][1] );
72 XMesaDrawPoint( dpy
, buffer
, gc
, x
, y
);
77 /* Color index mode */
78 for (i
=first
;i
<=last
;i
++) {
79 if (VB
->ClipMask
[i
]==0) {
81 XMesaSetForeground( dpy
, gc
, VB
->IndexPtr
->data
[i
] );
82 x
= (GLint
) VB
->Win
.data
[i
][0];
83 y
= FLIP( xmesa
->xm_buffer
, (GLint
) VB
->Win
.data
[i
][1] );
84 XMesaDrawPoint( dpy
, buffer
, gc
, x
, y
);
93 * Analyze context state to see if we can provide a fast points drawing
94 * function, like those in points.c. Otherwise, return NULL.
96 points_func
xmesa_get_points_func( GLcontext
*ctx
)
98 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
100 if (ctx
->Point
.Size
==1.0F
&& !ctx
->Point
.SmoothFlag
&& ctx
->RasterMask
==0
101 && !ctx
->Texture
.Enabled
) {
102 if (xmesa
->xm_buffer
->buffer
==XIMAGE
) {
103 return NULL
; /*draw_points_ximage;*/
106 return draw_points_ANY_pixmap
;
116 /**********************************************************************/
117 /*** Line rendering ***/
118 /**********************************************************************/
123 * Render a line into a pixmap, any pixel format.
125 static void flat_pixmap_line( GLcontext
*ctx
,
126 GLuint vert0
, GLuint vert1
, GLuint pv
)
128 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
129 struct vertex_buffer
*VB
= ctx
->VB
;
130 register int x0
, y0
, x1
, y1
;
133 if (xmesa
->xm_visual
->gl_visual
->RGBAflag
) {
134 const GLubyte
*color
= VB
->ColorPtr
->data
[pv
];
135 pixel
= xmesa_color_to_pixel( xmesa
, color
[0], color
[1], color
[2], color
[3],
136 xmesa
->pixelformat
);
139 pixel
= VB
->IndexPtr
->data
[pv
];
141 gc
= xmesa
->xm_buffer
->gc2
;
142 XMesaSetForeground( xmesa
->display
, gc
, pixel
);
144 x0
= (GLint
) VB
->Win
.data
[vert0
][0];
145 y0
= FLIP( xmesa
->xm_buffer
, (GLint
) VB
->Win
.data
[vert0
][1] );
146 x1
= (GLint
) VB
->Win
.data
[vert1
][0];
147 y1
= FLIP( xmesa
->xm_buffer
, (GLint
) VB
->Win
.data
[vert1
][1] );
148 XMesaDrawLine( xmesa
->display
, xmesa
->xm_buffer
->buffer
, gc
,
155 * Draw a flat-shaded, PF_TRUECOLOR line into an XImage.
157 static void flat_TRUECOLOR_line( GLcontext
*ctx
,
158 GLuint vert0
, GLuint vert1
, GLuint pv
)
160 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
161 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
162 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
164 PACK_TRUECOLOR( pixel
, color
[0], color
[1], color
[2] );
168 #define PLOT(X,Y) XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel );
170 #include "linetemp.h"
176 * Draw a flat-shaded, PF_8A8B8G8R line into an XImage.
178 static void flat_8A8B8G8R_line( GLcontext
*ctx
,
179 GLuint vert0
, GLuint vert1
, GLuint pv
)
181 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
182 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
183 GLuint pixel
= PACK_8B8G8R( color
[0], color
[1], color
[2] );
185 #define PIXEL_TYPE GLuint
186 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
187 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
189 #define PLOT(X,Y) *pixelPtr = pixel;
191 #include "linetemp.h"
196 * Draw a flat-shaded, PF_8R8G8B line into an XImage.
198 static void flat_8R8G8B_line( GLcontext
*ctx
,
199 GLuint vert0
, GLuint vert1
, GLuint pv
)
201 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
202 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
203 GLuint pixel
= PACK_8R8G8B( color
[0], color
[1], color
[2] );
205 #define PIXEL_TYPE GLuint
206 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
207 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
209 #define PLOT(X,Y) *pixelPtr = pixel;
211 #include "linetemp.h"
216 * Draw a flat-shaded, PF_8R8G8B24 line into an XImage.
218 static void flat_8R8G8B24_line( GLcontext
*ctx
,
219 GLuint vert0
, GLuint vert1
, GLuint pv
)
221 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
222 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
224 #define PIXEL_TYPE bgr_t
225 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
226 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
228 #define PLOT(X,Y) { \
229 pixelPtr->r = color[RCOMP]; \
230 pixelPtr->g = color[GCOMP]; \
231 pixelPtr->b = color[BCOMP]; \
234 #include "linetemp.h"
239 * Draw a flat-shaded, PF_5R6G5B line into an XImage.
241 static void flat_5R6G5B_line( GLcontext
*ctx
,
242 GLuint vert0
, GLuint vert1
, GLuint pv
)
244 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
245 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
246 GLushort pixel
= PACK_5R6G5B( color
[0], color
[1], color
[2] );
248 #define PIXEL_TYPE GLushort
249 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
250 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
252 #define PLOT(X,Y) *pixelPtr = pixel;
254 #include "linetemp.h"
259 * Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage.
261 static void flat_DITHER_5R6G5B_line( GLcontext
*ctx
,
262 GLuint vert0
, GLuint vert1
, GLuint pv
)
264 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
265 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
267 #define PIXEL_TYPE GLushort
268 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
269 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
271 #define PLOT(X,Y) PACK_TRUEDITHER( *pixelPtr, X, Y, color[0], color[1], color[2] );
273 #include "linetemp.h"
279 * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage.
281 static void flat_DITHER8_line( GLcontext
*ctx
,
282 GLuint vert0
, GLuint vert1
, GLuint pv
)
284 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
285 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
286 GLint r
= color
[0], g
= color
[1], b
= color
[2];
290 #define PIXEL_TYPE GLubyte
291 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
292 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
294 #define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b);
296 #include "linetemp.h"
301 * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage.
303 static void flat_LOOKUP8_line( GLcontext
*ctx
,
304 GLuint vert0
, GLuint vert1
, GLuint pv
)
306 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
307 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
310 pixel
= (GLubyte
) LOOKUP( color
[0], color
[1], color
[2] );
312 #define PIXEL_TYPE GLubyte
313 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
314 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
316 #define PLOT(X,Y) *pixelPtr = pixel;
318 #include "linetemp.h"
323 * Draw a flat-shaded, PF_HPCR line into an XImage.
325 static void flat_HPCR_line( GLcontext
*ctx
,
326 GLuint vert0
, GLuint vert1
, GLuint pv
)
328 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
329 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
330 GLint r
= color
[0], g
= color
[1], b
= color
[2];
333 #define PIXEL_TYPE GLubyte
334 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
335 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
337 #define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b);
339 #include "linetemp.h"
345 * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage.
347 static void flat_TRUECOLOR_z_line( GLcontext
*ctx
,
348 GLuint vert0
, GLuint vert1
, GLuint pv
)
350 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
351 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
352 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
354 PACK_TRUECOLOR( pixel
, color
[0], color
[1], color
[2] );
358 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
363 XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel ); \
366 #include "linetemp.h"
371 * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage.
373 static void flat_8A8B8G8R_z_line( GLcontext
*ctx
,
374 GLuint vert0
, GLuint vert1
, GLuint pv
)
376 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
377 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
378 GLuint pixel
= PACK_8B8G8R( color
[0], color
[1], color
[2] );
381 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
382 #define PIXEL_TYPE GLuint
383 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
384 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
392 #include "linetemp.h"
397 * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage.
399 static void flat_8R8G8B_z_line( GLcontext
*ctx
,
400 GLuint vert0
, GLuint vert1
, GLuint pv
)
402 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
403 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
404 GLuint pixel
= PACK_8R8G8B( color
[0], color
[1], color
[2] );
407 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
408 #define PIXEL_TYPE GLuint
409 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
410 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
418 #include "linetemp.h"
423 * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage.
425 static void flat_8R8G8B24_z_line( GLcontext
*ctx
,
426 GLuint vert0
, GLuint vert1
, GLuint pv
)
428 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
429 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
432 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
433 #define PIXEL_TYPE bgr_t
434 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
435 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
440 pixelPtr->r = color[RCOMP]; \
441 pixelPtr->g = color[GCOMP]; \
442 pixelPtr->b = color[BCOMP]; \
445 #include "linetemp.h"
450 * Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage.
452 static void flat_5R6G5B_z_line( GLcontext
*ctx
,
453 GLuint vert0
, GLuint vert1
, GLuint pv
)
455 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
456 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
457 GLushort pixel
= PACK_5R6G5B( color
[0], color
[1], color
[2] );
460 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
461 #define PIXEL_TYPE GLushort
462 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
463 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
470 #include "linetemp.h"
475 * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage.
477 static void flat_DITHER_5R6G5B_z_line( GLcontext
*ctx
,
478 GLuint vert0
, GLuint vert1
, GLuint pv
)
480 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
481 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
484 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
485 #define PIXEL_TYPE GLushort
486 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
487 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
492 PACK_TRUEDITHER(*pixelPtr, X, Y, color[0], color[1], color[2]); \
494 #include "linetemp.h"
499 * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage.
501 static void flat_DITHER8_z_line( GLcontext
*ctx
,
502 GLuint vert0
, GLuint vert1
, GLuint pv
)
504 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
505 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
506 GLint r
= color
[0], g
= color
[1], b
= color
[2];
511 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
512 #define PIXEL_TYPE GLubyte
513 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
514 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
519 *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b); \
521 #include "linetemp.h"
526 * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage.
528 static void flat_LOOKUP8_z_line( GLcontext
*ctx
,
529 GLuint vert0
, GLuint vert1
, GLuint pv
)
531 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
532 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
535 pixel
= (GLubyte
) LOOKUP( color
[0], color
[1], color
[2] );
538 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
539 #define PIXEL_TYPE GLubyte
540 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
541 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
549 #include "linetemp.h"
554 * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage.
556 static void flat_HPCR_z_line( GLcontext
*ctx
,
557 GLuint vert0
, GLuint vert1
, GLuint pv
)
559 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
560 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
561 GLint r
= color
[0], g
= color
[1], b
= color
[2];
565 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
566 #define PIXEL_TYPE GLubyte
567 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
568 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
573 *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \
576 #include "linetemp.h"
582 * Examine ctx->Line attributes and set xmesa->xm_buffer->gc1
583 * and xmesa->xm_buffer->gc2 appropriately.
585 static void setup_x_line_options( GLcontext
*ctx
)
587 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
588 int i
, state
, state0
, new_state
, len
, offs
;
593 int line_width
, line_style
;
595 /*** Line Stipple ***/
596 if (ctx
->Line
.StippleFlag
) {
597 const int pattern
= ctx
->Line
.StipplePattern
;
600 state0
= state
= ((pattern
& 1) != 0);
602 /* Decompose the pattern */
603 for (i
=1,tbit
=2,len
=1;i
<16;++i
,tbit
=(tbit
<<1))
605 new_state
= ((tbit
& pattern
) != 0);
606 if (state
!= new_state
)
608 *dptr
++ = ctx
->Line
.StippleFactor
* len
;
615 *dptr
= ctx
->Line
.StippleFactor
* len
;
616 n_segments
= 1 + (dptr
- dashes
);
618 /* ensure an even no. of segments, or X may toggle on/off for consecutive patterns */
619 /* if (n_segments & 1) dashes [n_segments++] = 0; value of 0 not allowed in dash list */
621 /* Handle case where line style starts OFF */
628 fprintf (stderr
, "input pattern: 0x%04x, offset %d, %d segments:", pattern
, offs
, n_segments
);
629 for (i
= 0; i
< n_segments
; i
++)
630 fprintf (stderr
, " %d", dashes
[i
]);
631 fprintf (stderr
, "\n");
634 XMesaSetDashes( xmesa
->display
, xmesa
->xm_buffer
->gc1
,
635 offs
, dashes
, n_segments
);
636 XMesaSetDashes( xmesa
->display
, xmesa
->xm_buffer
->gc2
,
637 offs
, dashes
, n_segments
);
639 line_style
= LineOnOffDash
;
642 line_style
= LineSolid
;
646 line_width
= (int) (ctx
->Line
.Width
+0.5F
);
647 if (line_width
< 2) {
648 /* Use fast lines when possible */
652 /*** Set GC attributes ***/
653 XMesaSetLineAttributes( xmesa
->display
, xmesa
->xm_buffer
->gc1
,
654 line_width
, line_style
, CapButt
, JoinBevel
);
655 XMesaSetLineAttributes( xmesa
->display
, xmesa
->xm_buffer
->gc2
,
656 line_width
, line_style
, CapButt
, JoinBevel
);
657 XMesaSetFillStyle( xmesa
->display
, xmesa
->xm_buffer
->gc1
, FillSolid
);
658 XMesaSetFillStyle( xmesa
->display
, xmesa
->xm_buffer
->gc2
, FillSolid
);
665 * Analyze context state to see if we can provide a fast line drawing
666 * function, like those in lines.c. Otherwise, return NULL.
668 line_func
xmesa_get_line_func( GLcontext
*ctx
)
670 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
671 int depth
= GET_VISUAL_DEPTH(xmesa
->xm_visual
);
673 (void) DitherValues
; /* silence unused var warning */
674 (void) kernel1
; /* silence unused var warning */
676 if (ctx
->Line
.SmoothFlag
) return NULL
;
677 if (ctx
->Texture
.Enabled
) return NULL
;
678 if (ctx
->Light
.ShadeModel
!=GL_FLAT
) return NULL
;
679 /* X line stippling doesn't match OpenGL stippling */
680 if (ctx
->Line
.StippleFlag
==GL_TRUE
) return NULL
;
682 if (xmesa
->xm_buffer
->buffer
==XIMAGE
683 && ctx
->RasterMask
==DEPTH_BIT
684 && ctx
->Depth
.Func
==GL_LESS
685 && ctx
->Depth
.Mask
==GL_TRUE
686 && ctx
->Visual
->DepthBits
== DEFAULT_SOFTWARE_DEPTH_BITS
687 && ctx
->Line
.Width
==1.0F
) {
688 switch (xmesa
->pixelformat
) {
690 return flat_TRUECOLOR_z_line
;
692 return flat_8A8B8G8R_z_line
;
694 return flat_8R8G8B_z_line
;
696 return flat_8R8G8B24_z_line
;
698 return flat_5R6G5B_z_line
;
699 case PF_DITHER_5R6G5B
:
700 return flat_DITHER_5R6G5B_z_line
;
702 return (depth
==8) ? flat_DITHER8_z_line
: NULL
;
704 return (depth
==8) ? flat_LOOKUP8_z_line
: NULL
;
706 return flat_HPCR_z_line
;
711 if (xmesa
->xm_buffer
->buffer
==XIMAGE
712 && ctx
->RasterMask
==0
713 && ctx
->Line
.Width
==1.0F
) {
714 switch (xmesa
->pixelformat
) {
716 return flat_TRUECOLOR_line
;
718 return flat_8A8B8G8R_line
;
720 return flat_8R8G8B_line
;
722 return flat_8R8G8B24_line
;
724 return flat_5R6G5B_line
;
725 case PF_DITHER_5R6G5B
:
726 return flat_DITHER_5R6G5B_line
;
728 return (depth
==8) ? flat_DITHER8_line
: NULL
;
730 return (depth
==8) ? flat_LOOKUP8_line
: NULL
;
732 return flat_HPCR_line
;
738 /* XXX have to disable this because X's rasterization rules don't match
739 * software Mesa's. This causes the linehv.c conformance test to fail.
740 * In the future, we might provide a config option to enable this.
742 if (xmesa
->xm_buffer
->buffer
!=XIMAGE
&& ctx
->RasterMask
==0) {
743 setup_x_line_options( ctx
);
744 return flat_pixmap_line
;