1 /* $Id: drawpix.c,v 1.14 2000/03/03 17:54:56 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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.
50 * Given the dest position, size and skipPixels and skipRows values
51 * for a glDrawPixels command, perform clipping of the image bounds
52 * so the result lies withing the context's buffer bounds.
53 * Return: GL_TRUE if image is ready for drawing
54 * GL_FALSE if image was completely clipped away (draw nothing)
57 _mesa_clip_pixelrect(const GLcontext
*ctx
,
58 GLint
*destX
, GLint
*destY
,
59 GLsizei
*width
, GLsizei
*height
,
60 GLint
*skipPixels
, GLint
*skipRows
)
62 const GLframebuffer
*buffer
= ctx
->DrawBuffer
;
65 if (*destX
< buffer
->Xmin
) {
66 *skipPixels
+= (buffer
->Xmin
- *destX
);
67 *width
-= (buffer
->Xmin
- *destX
);
68 *destX
= buffer
->Xmin
;
71 if (*destX
+ *width
> buffer
->Xmax
)
72 *width
-= (*destX
+ *width
- buffer
->Xmax
- 1);
78 if (*destY
< buffer
->Ymin
) {
79 *skipRows
+= (buffer
->Ymin
- *destY
);
80 *height
-= (buffer
->Ymin
- *destY
);
81 *destY
= buffer
->Ymin
;
84 if (*destY
+ *height
> buffer
->Ymax
)
85 *height
-= (*destY
+ *height
- buffer
->Ymax
- 1);
96 * Try to do a fast and simple RGB(a) glDrawPixels.
97 * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead
100 simple_DrawPixels( GLcontext
*ctx
, GLint x
, GLint y
,
101 GLsizei width
, GLsizei height
, GLenum format
, GLenum type
,
102 const GLvoid
*pixels
)
104 const struct gl_pixelstore_attrib
*unpack
= &ctx
->Unpack
;
105 GLubyte rgb
[MAX_WIDTH
][3];
106 GLubyte rgba
[MAX_WIDTH
][4];
108 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glDrawPixels",
112 if (!ctx
->Current
.RasterPosValid
) {
118 gl_update_state(ctx
);
121 if ((ctx
->RasterMask
&(~(SCISSOR_BIT
|WINCLIP_BIT
)))==0
122 && ctx
->Pixel
.RedBias
==0.0 && ctx
->Pixel
.RedScale
==1.0
123 && ctx
->Pixel
.GreenBias
==0.0 && ctx
->Pixel
.GreenScale
==1.0
124 && ctx
->Pixel
.BlueBias
==0.0 && ctx
->Pixel
.BlueScale
==1.0
125 && ctx
->Pixel
.AlphaBias
==0.0 && ctx
->Pixel
.AlphaScale
==1.0
126 && ctx
->Pixel
.IndexShift
==0 && ctx
->Pixel
.IndexOffset
==0
127 && ctx
->Pixel
.MapColorFlag
==0
128 && unpack
->Alignment
==1
129 && !unpack
->SwapBytes
130 && !unpack
->LsbFirst
) {
134 GLint drawWidth
= width
; /* actual width drawn */
135 GLint drawHeight
= height
; /* actual height drawn */
136 GLint skipPixels
= unpack
->SkipPixels
;
137 GLint skipRows
= unpack
->SkipRows
;
139 GLdepth zSpan
[MAX_WIDTH
]; /* only used when zooming */
142 if (unpack
->RowLength
> 0)
143 rowLength
= unpack
->RowLength
;
147 /* If we're not using pixel zoom then do all clipping calculations
148 * now. Otherwise, we'll let the gl_write_zoomed_*_span() functions
149 * handle the clipping.
151 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
152 /* horizontal clipping */
153 if (destX
< ctx
->DrawBuffer
->Xmin
) {
154 skipPixels
+= (ctx
->DrawBuffer
->Xmin
- destX
);
155 drawWidth
-= (ctx
->DrawBuffer
->Xmin
- destX
);
156 destX
= ctx
->DrawBuffer
->Xmin
;
158 if (destX
+ drawWidth
> ctx
->DrawBuffer
->Xmax
)
159 drawWidth
-= (destX
+ drawWidth
- ctx
->DrawBuffer
->Xmax
- 1);
163 /* vertical clipping */
164 if (destY
< ctx
->DrawBuffer
->Ymin
) {
165 skipRows
+= (ctx
->DrawBuffer
->Ymin
- destY
);
166 drawHeight
-= (ctx
->DrawBuffer
->Ymin
- destY
);
167 destY
= ctx
->DrawBuffer
->Ymin
;
169 if (destY
+ drawHeight
> ctx
->DrawBuffer
->Ymax
)
170 drawHeight
-= (destY
+ drawHeight
- ctx
->DrawBuffer
->Ymax
- 1);
174 zoomY0
= 0; /* not used - silence compiler warning */
177 /* setup array of fragment Z value to pass to zoom function */
178 GLdepth z
= (GLdepth
) (ctx
->Current
.RasterPos
[2] * ctx
->Visual
->DepthMaxF
);
180 assert(drawWidth
< MAX_WIDTH
);
181 for (i
=0; i
<drawWidth
; i
++)
184 /* save Y value of first row */
185 zoomY0
= (GLint
) (ctx
->Current
.RasterPos
[1] + 0.5F
);
191 * The window region at (destX, destY) of size (drawWidth, drawHeight)
192 * will be written to.
193 * We'll take pixel data from buffer pointed to by "pixels" but we'll
194 * skip "skipRows" rows and skip "skipPixels" pixels/row.
197 if (format
==GL_RGBA
&& type
==GL_UNSIGNED_BYTE
) {
198 if (ctx
->Visual
->RGBAflag
) {
199 GLubyte
*src
= (GLubyte
*) pixels
200 + (skipRows
* rowLength
+ skipPixels
) * 4;
201 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
204 for (row
=0; row
<drawHeight
; row
++) {
205 (*ctx
->Driver
.WriteRGBASpan
)(ctx
, drawWidth
, destX
, destY
,
207 src
+= rowLength
* 4;
214 for (row
=0; row
<drawHeight
; row
++) {
215 gl_write_zoomed_rgba_span(ctx
, drawWidth
, destX
, destY
,
216 zSpan
, (void *) src
, zoomY0
);
217 src
+= rowLength
* 4;
224 else if (format
==GL_RGB
&& type
==GL_UNSIGNED_BYTE
) {
225 if (ctx
->Visual
->RGBAflag
) {
226 GLubyte
*src
= (GLubyte
*) pixels
227 + (skipRows
* rowLength
+ skipPixels
) * 3;
228 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
230 for (row
=0; row
<drawHeight
; row
++) {
231 (*ctx
->Driver
.WriteRGBSpan
)(ctx
, drawWidth
, destX
, destY
,
233 src
+= rowLength
* 3;
240 for (row
=0; row
<drawHeight
; row
++) {
241 gl_write_zoomed_rgb_span(ctx
, drawWidth
, destX
, destY
,
242 zSpan
, (void *) src
, zoomY0
);
243 src
+= rowLength
* 3;
250 else if (format
==GL_LUMINANCE
&& type
==GL_UNSIGNED_BYTE
) {
251 if (ctx
->Visual
->RGBAflag
) {
252 GLubyte
*src
= (GLubyte
*) pixels
253 + (skipRows
* rowLength
+ skipPixels
);
254 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
257 assert(drawWidth
< MAX_WIDTH
);
258 for (row
=0; row
<drawHeight
; row
++) {
260 for (i
=0;i
<drawWidth
;i
++) {
265 (*ctx
->Driver
.WriteRGBSpan
)(ctx
, drawWidth
, destX
, destY
,
274 assert(drawWidth
< MAX_WIDTH
);
275 for (row
=0; row
<drawHeight
; row
++) {
277 for (i
=0;i
<drawWidth
;i
++) {
282 gl_write_zoomed_rgb_span(ctx
, drawWidth
, destX
, destY
,
283 zSpan
, (void *) rgb
, zoomY0
);
291 else if (format
==GL_LUMINANCE_ALPHA
&& type
==GL_UNSIGNED_BYTE
) {
292 if (ctx
->Visual
->RGBAflag
) {
293 GLubyte
*src
= (GLubyte
*) pixels
294 + (skipRows
* rowLength
+ skipPixels
)*2;
295 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
298 assert(drawWidth
< MAX_WIDTH
);
299 for (row
=0; row
<drawHeight
; row
++) {
302 for (i
=0;i
<drawWidth
;i
++) {
308 (*ctx
->Driver
.WriteRGBASpan
)(ctx
, drawWidth
, destX
, destY
,
309 (void *) rgba
, NULL
);
317 assert(drawWidth
< MAX_WIDTH
);
318 for (row
=0; row
<drawHeight
; row
++) {
321 for (i
=0;i
<drawWidth
;i
++) {
327 gl_write_zoomed_rgba_span(ctx
, drawWidth
, destX
, destY
,
328 zSpan
, (void *) rgba
, zoomY0
);
336 else if (format
==GL_COLOR_INDEX
&& type
==GL_UNSIGNED_BYTE
) {
337 GLubyte
*src
= (GLubyte
*) pixels
+ skipRows
* rowLength
+ skipPixels
;
338 if (ctx
->Visual
->RGBAflag
) {
339 /* convert CI data to RGBA */
340 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
343 for (row
=0; row
<drawHeight
; row
++) {
344 assert(drawWidth
< MAX_WIDTH
);
345 gl_map_ci8_to_rgba(ctx
, drawWidth
, src
, rgba
);
346 (*ctx
->Driver
.WriteRGBASpan
)(ctx
, drawWidth
, destX
, destY
,
347 (const GLubyte (*)[4])rgba
,
357 for (row
=0; row
<drawHeight
; row
++) {
358 assert(drawWidth
< MAX_WIDTH
);
359 gl_map_ci8_to_rgba(ctx
, drawWidth
, src
, rgba
);
360 gl_write_zoomed_rgba_span(ctx
, drawWidth
, destX
, destY
,
361 zSpan
, (void *) rgba
, zoomY0
);
369 /* write CI data to CI frame buffer */
371 if (ctx
->Pixel
.ZoomX
==1.0F
&& ctx
->Pixel
.ZoomY
==1.0F
) {
373 for (row
=0; row
<drawHeight
; row
++) {
374 (*ctx
->Driver
.WriteCI8Span
)(ctx
, drawWidth
, destX
, destY
,
388 /* can't handle this pixel format and/or data type here */
393 /* can't do a simple draw, have to use slow path */
400 * Do glDrawPixels of index pixels.
403 draw_index_pixels( GLcontext
*ctx
, GLint x
, GLint y
,
404 GLsizei width
, GLsizei height
,
405 GLenum type
, const GLvoid
*pixels
)
407 const GLboolean zoom
= ctx
->Pixel
.ZoomX
!=1.0 || ctx
->Pixel
.ZoomY
!=1.0;
408 const GLint desty
= y
;
409 GLint row
, drawWidth
;
410 GLdepth zspan
[MAX_WIDTH
];
412 drawWidth
= (width
> MAX_WIDTH
) ? MAX_WIDTH
: width
;
414 /* Fragment depth values */
415 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
416 GLdepth zval
= (GLdepth
) (ctx
->Current
.RasterPos
[2] * ctx
->Visual
->DepthMaxF
);
418 for (i
= 0; i
< drawWidth
; i
++) {
426 for (row
= 0; row
< height
; row
++, y
++) {
427 GLuint indexes
[MAX_WIDTH
];
428 const GLvoid
*source
= gl_pixel_addr_in_image(&ctx
->Unpack
,
429 pixels
, width
, height
, GL_COLOR_INDEX
, type
, 0, row
, 0);
430 _mesa_unpack_index_span(ctx
, drawWidth
, GL_UNSIGNED_INT
, indexes
,
431 type
, source
, &ctx
->Unpack
, GL_TRUE
);
433 gl_write_zoomed_index_span(ctx
, drawWidth
, x
, y
, zspan
, indexes
, desty
);
436 gl_write_index_span(ctx
, drawWidth
, x
, y
, zspan
, indexes
, GL_BITMAP
);
444 * Do glDrawPixels of stencil image. The image datatype may either
445 * be GLubyte or GLbitmap.
448 draw_stencil_pixels( GLcontext
*ctx
, GLint x
, GLint y
,
449 GLsizei width
, GLsizei height
,
450 GLenum type
, const GLvoid
*pixels
)
452 const GLboolean zoom
= ctx
->Pixel
.ZoomX
!=1.0 || ctx
->Pixel
.ZoomY
!=1.0;
453 const GLint desty
= y
;
454 GLint row
, drawWidth
;
456 if (type
!= GL_BYTE
&&
457 type
!= GL_UNSIGNED_BYTE
&&
459 type
!= GL_UNSIGNED_SHORT
&&
461 type
!= GL_UNSIGNED_INT
&&
464 gl_error( ctx
, GL_INVALID_ENUM
, "glDrawPixels(stencil type)");
468 drawWidth
= (width
> MAX_WIDTH
) ? MAX_WIDTH
: width
;
470 for (row
= 0; row
< height
; row
++, y
++) {
471 GLstencil values
[MAX_WIDTH
];
472 GLenum destType
= (sizeof(GLstencil
) == sizeof(GLubyte
))
473 ? GL_UNSIGNED_BYTE
: GL_UNSIGNED_SHORT
;
474 const GLvoid
*source
= gl_pixel_addr_in_image(&ctx
->Unpack
,
475 pixels
, width
, height
, GL_COLOR_INDEX
, type
, 0, row
, 0);
476 _mesa_unpack_index_span(ctx
, drawWidth
, destType
, values
,
477 type
, source
, &ctx
->Unpack
, GL_TRUE
);
480 gl_write_zoomed_stencil_span( ctx
, (GLuint
) drawWidth
, x
, y
,
484 gl_write_stencil_span( ctx
, (GLuint
) drawWidth
, x
, y
, values
);
492 * Do a glDrawPixels of depth values.
495 draw_depth_pixels( GLcontext
*ctx
, GLint x
, GLint y
,
496 GLsizei width
, GLsizei height
,
497 GLenum type
, const GLvoid
*pixels
)
499 const GLboolean bias_or_scale
= ctx
->Pixel
.DepthBias
!=0.0 || ctx
->Pixel
.DepthScale
!=1.0;
500 const GLboolean zoom
= ctx
->Pixel
.ZoomX
!=1.0 || ctx
->Pixel
.ZoomY
!=1.0;
501 const GLint desty
= y
;
502 GLubyte rgba
[MAX_WIDTH
][4];
503 GLuint ispan
[MAX_WIDTH
];
504 GLint drawWidth
= (width
> MAX_WIDTH
) ? MAX_WIDTH
: width
;
506 if (type
!= GL_UNSIGNED_BYTE
507 && type
!= GL_UNSIGNED_BYTE
508 && type
!= GL_UNSIGNED_SHORT
509 && type
!= GL_UNSIGNED_SHORT
510 && type
!= GL_UNSIGNED_INT
511 && type
!= GL_UNSIGNED_INT
512 && type
!= GL_FLOAT
) {
513 gl_error(ctx
, GL_INVALID_ENUM
, "glDrawPixels(type)");
517 /* Colors or indexes */
518 if (ctx
->Visual
->RGBAflag
) {
519 GLint r
= (GLint
) (ctx
->Current
.RasterColor
[0] * 255.0F
);
520 GLint g
= (GLint
) (ctx
->Current
.RasterColor
[1] * 255.0F
);
521 GLint b
= (GLint
) (ctx
->Current
.RasterColor
[2] * 255.0F
);
522 GLint a
= (GLint
) (ctx
->Current
.RasterColor
[3] * 255.0F
);
524 for (i
= 0; i
< drawWidth
; i
++) {
533 for (i
= 0; i
< drawWidth
; i
++) {
534 ispan
[i
] = ctx
->Current
.RasterIndex
;
538 if (type
==GL_UNSIGNED_SHORT
&& sizeof(GLdepth
)==sizeof(GLushort
)
539 && !bias_or_scale
&& !zoom
&& ctx
->Visual
->RGBAflag
) {
540 /* Special case: directly write 16-bit depth values */
542 for (row
= 0; row
< height
; row
++, y
++) {
543 GLdepth zspan
[MAX_WIDTH
];
544 const GLushort
*zptr
= gl_pixel_addr_in_image(&ctx
->Unpack
,
545 pixels
, width
, height
, GL_DEPTH_COMPONENT
, type
, 0, row
, 0);
547 for (i
= 0; i
< width
; i
++)
549 gl_write_rgba_span( ctx
, width
, x
, y
, zspan
, rgba
, GL_BITMAP
);
552 else if (type
==GL_UNSIGNED_INT
&& ctx
->Visual
->DepthBits
== 32
553 && !bias_or_scale
&& !zoom
&& ctx
->Visual
->RGBAflag
) {
554 /* Special case: directly write 32-bit depth values */
556 for (row
= 0; row
< height
; row
++, y
++) {
557 const GLuint
*zptr
= gl_pixel_addr_in_image(&ctx
->Unpack
,
558 pixels
, width
, height
, GL_DEPTH_COMPONENT
, type
, 0, row
, 0);
559 gl_write_rgba_span( ctx
, width
, x
, y
, zptr
, rgba
, GL_BITMAP
);
565 for (row
= 0; row
< height
; row
++, y
++) {
566 GLdepth zspan
[MAX_WIDTH
];
567 const GLvoid
*src
= gl_pixel_addr_in_image(&ctx
->Unpack
,
568 pixels
, width
, height
, GL_DEPTH_COMPONENT
, type
, 0, row
, 0);
569 _mesa_unpack_depth_span( ctx
, drawWidth
, zspan
, type
, src
,
570 &ctx
->Unpack
, GL_TRUE
);
571 if (ctx
->Visual
->RGBAflag
) {
573 gl_write_zoomed_rgba_span(ctx
, width
, x
, y
, zspan
,
574 (const GLubyte (*)[4])rgba
, desty
);
577 gl_write_rgba_span(ctx
, width
, x
, y
, zspan
, rgba
, GL_BITMAP
);
582 gl_write_zoomed_index_span(ctx
, width
, x
, y
, zspan
,
586 gl_write_index_span(ctx
, width
, x
, y
, zspan
, ispan
, GL_BITMAP
);
596 * Do glDrawPixels of RGBA pixels.
599 draw_rgba_pixels( GLcontext
*ctx
, GLint x
, GLint y
,
600 GLsizei width
, GLsizei height
,
601 GLenum format
, GLenum type
, const GLvoid
*pixels
)
603 const struct gl_pixelstore_attrib
*unpack
= &ctx
->Unpack
;
604 const GLboolean zoom
= ctx
->Pixel
.ZoomX
!=1.0 || ctx
->Pixel
.ZoomY
!=1.0;
605 const GLint desty
= y
;
606 GLdepth zspan
[MAX_WIDTH
];
609 /* Try an optimized glDrawPixels first */
610 if (simple_DrawPixels(ctx
, x
, y
, width
, height
, format
, type
, pixels
))
613 /* Fragment depth values */
614 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
615 /* fill in array of z values */
616 GLdepth z
= (GLdepth
) (ctx
->Current
.RasterPos
[2] * ctx
->Visual
->DepthMaxF
);
618 for (i
=0;i
<width
;i
++) {
624 if (ctx
->RasterMask
== 0 && !zoom
626 && x
+ width
<= ctx
->DrawBuffer
->Width
627 && y
+ height
<= ctx
->DrawBuffer
->Height
) {
631 quickDraw
= GL_FALSE
;
638 GLubyte rgba
[MAX_WIDTH
][4];
640 if (width
> MAX_WIDTH
)
642 for (row
= 0; row
< height
; row
++, y
++) {
643 const GLvoid
*source
= gl_pixel_addr_in_image(unpack
,
644 pixels
, width
, height
, format
, type
, 0, row
, 0);
645 _mesa_unpack_ubyte_color_span(ctx
, width
, GL_RGBA
, (void*) rgba
,
646 format
, type
, source
, unpack
, GL_TRUE
);
649 (*ctx
->Driver
.WriteRGBASpan
)( ctx
, width
, x
, y
,
650 (CONST
GLubyte (*)[]) rgba
, NULL
);
653 gl_write_zoomed_rgba_span( ctx
, width
, x
, y
, zspan
,
654 (CONST
GLubyte (*)[]) rgba
, desty
);
657 gl_write_rgba_span( ctx
, (GLuint
) width
, x
, y
, zspan
, rgba
, GL_BITMAP
);
666 * Execute glDrawPixels
669 _mesa_DrawPixels( GLsizei width
, GLsizei height
,
670 GLenum format
, GLenum type
, const GLvoid
*pixels
)
672 GET_CURRENT_CONTEXT(ctx
);
673 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glDrawPixels");
675 if (ctx
->RenderMode
==GL_RENDER
) {
677 if (!pixels
|| !ctx
->Current
.RasterPosValid
) {
681 x
= (GLint
) (ctx
->Current
.RasterPos
[0] + 0.5F
);
682 y
= (GLint
) (ctx
->Current
.RasterPos
[1] + 0.5F
);
684 /* see if device driver can do the drawpix */
685 if (ctx
->Driver
.DrawPixels
686 && (*ctx
->Driver
.DrawPixels
)(ctx
, x
, y
, width
, height
, format
, type
,
687 &ctx
->Unpack
, pixels
)) {
692 case GL_STENCIL_INDEX
:
693 draw_stencil_pixels( ctx
, x
, y
, width
, height
, type
, pixels
);
695 case GL_DEPTH_COMPONENT
:
696 draw_depth_pixels( ctx
, x
, y
, width
, height
, type
, pixels
);
699 if (ctx
->Visual
->RGBAflag
)
700 draw_rgba_pixels(ctx
, x
,y
, width
, height
, format
, type
, pixels
);
702 draw_index_pixels(ctx
, x
, y
, width
, height
, type
, pixels
);
709 case GL_LUMINANCE_ALPHA
:
715 draw_rgba_pixels(ctx
, x
, y
, width
, height
, format
, type
, pixels
);
718 gl_error( ctx
, GL_INVALID_ENUM
, "glDrawPixels(format)" );
722 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
723 if (ctx
->Current
.RasterPosValid
) {
725 GLfloat texcoord
[4], invq
;
726 UBYTE_RGBA_TO_FLOAT_RGBA(color
, ctx
->Current
.ByteColor
);
727 invq
= 1.0F
/ ctx
->Current
.Texcoord
[0][3];
728 texcoord
[0] = ctx
->Current
.Texcoord
[0][0] * invq
;
729 texcoord
[1] = ctx
->Current
.Texcoord
[0][1] * invq
;
730 texcoord
[2] = ctx
->Current
.Texcoord
[0][2] * invq
;
731 texcoord
[3] = ctx
->Current
.Texcoord
[0][3];
732 FEEDBACK_TOKEN( ctx
, (GLfloat
) (GLint
) GL_DRAW_PIXEL_TOKEN
);
733 gl_feedback_vertex( ctx
,
734 ctx
->Current
.RasterPos
,
735 color
, ctx
->Current
.Index
, texcoord
);
738 else if (ctx
->RenderMode
==GL_SELECT
) {
739 if (ctx
->Current
.RasterPosValid
) {
740 gl_update_hitflag( ctx
, ctx
->Current
.RasterPos
[2] );