diff options
author | Brian Paul <[email protected]> | 2009-09-01 17:40:07 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-09-01 17:40:07 -0600 |
commit | 282f578dbd790d7e5d7f371c51b72f116cda3934 (patch) | |
tree | 1f8d167e60c1b48e3d506564fab438e274be788c /src | |
parent | 29e22059a927a6279d035cdb149b053f8a3e0bf4 (diff) |
mesa: skip bitmap drawing code if width==0 or height==0
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/drawpix.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 67311f71a26..aef6585641e 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -264,27 +264,30 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - const GLfloat epsilon = 0.0001F; - GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); - GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); - - if (ctx->Unpack.BufferObj->Name) { - /* unpack from PBO */ - if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBitmap(invalid PBO access)"); - return; - } - if (_mesa_bufferobj_mapped(ctx->Unpack.BufferObj)) { - /* buffer is mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return; + if (width > 0 && height > 0) { + const GLfloat epsilon = 0.0001F; + GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBitmap(invalid PBO access)"); + return; + } + if (_mesa_bufferobj_mapped(ctx->Unpack.BufferObj)) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBitmap(PBO is mapped)"); + return; + } } - } - ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); + } } #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { |