projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GL_SGI_texture_color_table extension (Eric Plante)
[mesa.git]
/
src
/
mesa
/
swrast
/
s_drawpix.c
diff --git
a/src/mesa/swrast/s_drawpix.c
b/src/mesa/swrast/s_drawpix.c
index 479c9cf99f6340d8ecab5eb28c59a9374001294d..a69f3cc3c95bd9e155fb11c626a5db91d0dc61ad 100644
(file)
--- a/
src/mesa/swrast/s_drawpix.c
+++ b/
src/mesa/swrast/s_drawpix.c
@@
-1,10
+1,10
@@
-/* $Id: s_drawpix.c,v 1.4
2 2002/12/18 15:02:19
brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.4
4 2003/01/16 18:57:44
brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
/*
* Mesa 3-D graphics library
* Version: 5.1
*
- * Copyright (C) 1999-200
2
Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-200
3
Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@
-522,11
+522,11
@@
draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
*/
skipPixels = 0;
while (skipPixels < width) {
*/
skipPixels = 0;
while (skipPixels < width) {
-
span.x
= x + (zoom ? 0 : skipPixels);
-
span.y
= y;
-
span.e
nd = (width - skipPixels > MAX_WIDTH)
- ? MAX_WIDTH : (width - skipPixels);
- ASSERT(span
.e
nd <= MAX_WIDTH);
+
const GLint spanX
= x + (zoom ? 0 : skipPixels);
+
GLint spanY
= y;
+
const GLint spanE
nd = (width - skipPixels > MAX_WIDTH)
+
? MAX_WIDTH : (width - skipPixels);
+ ASSERT(span
E
nd <= MAX_WIDTH);
for (row = 0; row < height; row++, span.y++) {
const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels,
width, height,
for (row = 0; row < height; row++, span.y++) {
const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels,
width, height,
@@
-535,12
+535,18
@@
draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
_mesa_unpack_index_span(ctx, span.end, GL_UNSIGNED_INT,
span.array->index, type, source, &ctx->Unpack,
ctx->_ImageTransferState);
_mesa_unpack_index_span(ctx, span.end, GL_UNSIGNED_INT,
span.array->index, type, source, &ctx->Unpack,
ctx->_ImageTransferState);
+
+ /* These may get changed during writing/clipping */
+ span.x = spanX;
+ span.y = spanY;
+ span.end = spanEnd;
+
if (zoom)
_mesa_write_zoomed_index_span(ctx, &span, y, skipPixels);
else
_mesa_write_index_span(ctx, &span);
}
if (zoom)
_mesa_write_zoomed_index_span(ctx, &span, y, skipPixels);
else
_mesa_write_index_span(ctx, &span);
}
- skipPixels += span
.e
nd;
+ skipPixels += span
E
nd;
}
}
}
}
@@
-578,10
+584,10
@@
draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
/* if width > MAX_WIDTH, have to process image in chunks */
skipPixels = 0;
while (skipPixels < width) {
/* if width > MAX_WIDTH, have to process image in chunks */
skipPixels = 0;
while (skipPixels < width) {
- GLint spanX = x;
+
const
GLint spanX = x;
GLint spanY = y;
GLint spanY = y;
- GLint spanWidth = (width - skipPixels > MAX_WIDTH)
- ? MAX_WIDTH : (width - skipPixels);
+
const
GLint spanWidth = (width - skipPixels > MAX_WIDTH)
+
? MAX_WIDTH : (width - skipPixels);
for (row = 0; row < height; row++, spanY++) {
GLstencil values[MAX_WIDTH];
for (row = 0; row < height; row++, spanY++) {
GLstencil values[MAX_WIDTH];
@@
-688,17
+694,25
@@
draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
/* in case width > MAX_WIDTH do the copy in chunks */
while (skipPixels < width) {
/* in case width > MAX_WIDTH do the copy in chunks */
while (skipPixels < width) {
-
span.x
= x + (zoom ? 0 : skipPixels);
-
span.y
= y;
-
span.e
nd = (width - skipPixels > MAX_WIDTH)
- ? MAX_WIDTH : (width - skipPixels);
+
const GLint spanX
= x + (zoom ? 0 : skipPixels);
+
GLint spanY
= y;
+
const GLint spanE
nd = (width - skipPixels > MAX_WIDTH)
+
? MAX_WIDTH : (width - skipPixels);
ASSERT(span.end <= MAX_WIDTH);
ASSERT(span.end <= MAX_WIDTH);
- for (row = 0; row < height; row++, span
.y
++) {
+ for (row = 0; row < height; row++, span
Y
++) {
GLfloat floatSpan[MAX_WIDTH];
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
pixels, width, height,
GL_DEPTH_COMPONENT, type,
0, row, skipPixels);
GLfloat floatSpan[MAX_WIDTH];
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
pixels, width, height,
GL_DEPTH_COMPONENT, type,
0, row, skipPixels);
+
+ /* Set these for each row since the _mesa_write_* function may
+ * change them while clipping.
+ */
+ span.x = spanX;
+ span.y = spanY;
+ span.end = spanEnd;
+
_mesa_unpack_depth_span(ctx, span.end, floatSpan, type,
src, &ctx->Unpack);
/* clamp depth values to [0,1] and convert from floats to ints */
_mesa_unpack_depth_span(ctx, span.end, floatSpan, type,
src, &ctx->Unpack);
/* clamp depth values to [0,1] and convert from floats to ints */
@@
-725,7
+739,7
@@
draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
_mesa_write_index_span(ctx, &span);
}
}
_mesa_write_index_span(ctx, &span);
}
}
- skipPixels += span
.e
nd;
+ skipPixels += span
E
nd;
}
}
}
}
}
}
@@
-832,20
+846,31
@@
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
* General solution
*/
{
* General solution
*/
{
+ const GLuint interpMask = span.interpMask;
+ const GLuint arrayMask = span.arrayMask;
GLint row, skipPixels = 0;
/* if the span is wider than MAX_WIDTH we have to do it in chunks */
while (skipPixels < width) {
GLint row, skipPixels = 0;
/* if the span is wider than MAX_WIDTH we have to do it in chunks */
while (skipPixels < width) {
-
span.x
= x + (zoom ? 0 : skipPixels);
-
span.y
= y;
-
span.e
nd = (width - skipPixels > MAX_WIDTH)
- ? MAX_WIDTH : (width - skipPixels);
+
const GLint spanX
= x + (zoom ? 0 : skipPixels);
+
GLint spanY
= y;
+
const GLint spanE
nd = (width - skipPixels > MAX_WIDTH)
+
? MAX_WIDTH : (width - skipPixels);
ASSERT(span.end <= MAX_WIDTH);
ASSERT(span.end <= MAX_WIDTH);
- for (row = 0; row < height; row++, span
.y
++) {
+ for (row = 0; row < height; row++, span
Y
++) {
const GLvoid *source = _mesa_image_address(unpack,
pixels, width, height, format, type, 0, row, skipPixels);
const GLvoid *source = _mesa_image_address(unpack,
pixels, width, height, format, type, 0, row, skipPixels);
+ /* Set these for each row since the _mesa_write_* function may
+ * change them while clipping.
+ */
+ span.x = spanX;
+ span.y = spanY;
+ span.end = spanEnd;
+ span.arrayMask = arrayMask;
+ span.interpMask = interpMask;
+
_mesa_unpack_chan_color_span(ctx, span.end, GL_RGBA,
(GLchan *) span.array->rgba,
format, type, source, unpack,
_mesa_unpack_chan_color_span(ctx, span.end, GL_RGBA,
(GLchan *) span.array->rgba,
format, type, source, unpack,
@@
-859,6
+884,7
@@
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
_swrast_pixel_texture(ctx, &span);
}
_swrast_pixel_texture(ctx, &span);
}
+ /* draw the span */
if (quickDraw) {
(*swrast->Driver.WriteRGBASpan)(ctx, span.end, span.x, span.y,
(CONST GLchan (*)[4]) span.array->rgba, NULL);
if (quickDraw) {
(*swrast->Driver.WriteRGBASpan)(ctx, span.end, span.x, span.y,
(CONST GLchan (*)[4]) span.array->rgba, NULL);
@@
-871,7
+897,8
@@
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
_mesa_write_rgba_span(ctx, &span);
}
}
_mesa_write_rgba_span(ctx, &span);
}
}
- skipPixels += span.end;
+
+ skipPixels += spanEnd;
}
}
}
}