summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/drawpix.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 67311f71a2..aef6585641 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) {