diff options
author | Brian Paul <[email protected]> | 2005-09-09 16:40:47 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-09-09 16:40:47 +0000 |
commit | 338cbb0e5c6eab982bc4d05df08108e1c9ce97d1 (patch) | |
tree | 9e1942211ae83a90e2d8223c6ba0150d172f87b8 /src | |
parent | b346213960057a25edf404e3323fc9da4dc54c0e (diff) |
don't generate selection hits for glBitmap, glDraw/CopyPixels. Misc clean-ups
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/drawpix.c | 161 |
1 files changed, 72 insertions, 89 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index d22c62a41d6..81a5bb0efcf 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -56,39 +56,34 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } - if (ctx->RenderMode==GL_RENDER) { - GLint x, y; - if (!ctx->Current.RasterPosValid) { - return; - } + if (!ctx->Current.RasterPosValid) { + return; + } - if (ctx->NewState) { - _mesa_update_state(ctx); - } + if (ctx->NewState) { + _mesa_update_state(ctx); + } + if (ctx->RenderMode == GL_RENDER) { /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ - x = IROUND(ctx->Current.RasterPos[0]); - y = IROUND(ctx->Current.RasterPos[1]); - + GLint x = IROUND(ctx->Current.RasterPos[0]); + GLint y = IROUND(ctx->Current.RasterPos[1]); ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, &ctx->Unpack, pixels); } - else if (ctx->RenderMode==GL_FEEDBACK) { + else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ - if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoords[0] ); - } + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } - else if (ctx->RenderMode==GL_SELECT) { - if (ctx->Current.RasterPosValid) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); - } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } @@ -98,7 +93,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ) { GET_CURRENT_CONTEXT(ctx); - GLint destx, desty; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { @@ -116,32 +110,29 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, _mesa_update_state(ctx); } - if (ctx->RenderMode==GL_RENDER) { - /* Destination of copy: */ - if (!ctx->Current.RasterPosValid) { - return; - } - - /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ - destx = IROUND(ctx->Current.RasterPos[0]); - desty = IROUND(ctx->Current.RasterPos[1]); + if (!ctx->Current.RasterPosValid) { + return; + } + if (ctx->RenderMode == GL_RENDER) { + /* Round to satisfy conformance tests (matches SGI's OpenGL) */ + GLint destx = IROUND(ctx->Current.RasterPos[0]); + GLint desty = IROUND(ctx->Current.RasterPos[1]); ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, type ); } else if (ctx->RenderMode == GL_FEEDBACK) { - if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoords[0] ); - } + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } - else if (ctx->RenderMode == GL_SELECT) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } @@ -190,36 +181,33 @@ _mesa_Bitmap( GLsizei width, GLsizei height, return; } - if (ctx->Current.RasterPosValid == GL_FALSE) { + if (!ctx->Current.RasterPosValid) { return; /* do nothing */ } - if (ctx->RenderMode==GL_RENDER) { + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); - - if (ctx->NewState) { - _mesa_update_state(ctx); - } - ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL - else if (ctx->RenderMode==GL_FEEDBACK) { - if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT(ctx, 0); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoords[0] ); - } + else if (ctx->RenderMode == GL_FEEDBACK) { + FLUSH_CURRENT(ctx, 0); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } else { ASSERT(ctx->RenderMode == GL_SELECT); - /* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */ + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } #endif @@ -253,40 +241,35 @@ _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, return; } - if (ctx->RenderMode==GL_RENDER) { - GLint x, y; - if (!colors || !depths || !ctx->Current.RasterPosValid) { - return; - } + if (!ctx->Current.RasterPosValid) { + return; + } - if (ctx->NewState) { - _mesa_update_state(ctx); - } + if (ctx->NewState) { + _mesa_update_state(ctx); + } + if (ctx->RenderMode == GL_RENDER) { /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ - x = IROUND(ctx->Current.RasterPos[0]); - y = IROUND(ctx->Current.RasterPos[1]); - + GLint x = IROUND(ctx->Current.RasterPos[0]); + GLint y = IROUND(ctx->Current.RasterPos[1]); ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height, colorFormat, colorType, colors, depthType, depths, &ctx->Unpack); } - else if (ctx->RenderMode==GL_FEEDBACK) { + else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ - if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoords[0] ); - } + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } - else if (ctx->RenderMode==GL_SELECT) { - if (ctx->Current.RasterPosValid) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); - } + else { + ASSERT(ctx->RenderMode == GL_SELECT); + /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } |