summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2007-07-30 16:17:40 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2007-07-30 16:17:40 +0800
commit775ebb696dffaf6fddc170862ecb375e6cdfcb9c (patch)
treeb9c7b01feea2dc960115f0d23264edad46739b92 /src
parent60179434d15989b81e2d4757f34033009184a678 (diff)
Fix an error related to glPolygonStipple.
As glPixelStore(GL_UNPACK) affect the bits into a stipple pattern, hence 128 bytes used to store the pattern in a display list aren't enough sometimes.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/dlist.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 293ee5fa34..f50c19f2ce 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -2723,15 +2723,17 @@ static void GLAPIENTRY
save_PolygonStipple(const GLubyte * pattern)
{
GET_CURRENT_CONTEXT(ctx);
+ GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
+ pattern, &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1);
if (n) {
- void *data;
- n[1].data = _mesa_malloc(32 * 4);
- data = n[1].data; /* This needed for Acorn compiler */
- MEMCPY(data, pattern, 32 * 4);
+ n[1].data = image;
+ } else if (image) {
+ _mesa_free(image);
}
+
if (ctx->ExecuteFlag) {
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
}
@@ -6169,7 +6171,12 @@ execute_list(GLcontext *ctx, GLuint list)
CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
break;
case OPCODE_POLYGON_STIPPLE:
- CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
+ {
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
+ CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
+ ctx->Unpack = save; /* restore */
+ }
break;
case OPCODE_POLYGON_OFFSET:
CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));