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