GL_MESA_pack_invert
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: extensions.c,v 1.79 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: extensions.c,v 1.80 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -111,6 +111,7 @@ static struct {
|
||||
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
|
||||
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
|
||||
{ OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
|
||||
{ OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) },
|
||||
{ OFF, "GL_MESA_packed_depth_stencil", 0 },
|
||||
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
|
||||
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
|
||||
@@ -183,6 +184,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
|
||||
"GL_HP_occlusion_test",
|
||||
"GL_IBM_texture_mirrored_repeat",
|
||||
"GL_INGR_blend_func_separate",
|
||||
"GL_MESA_pack_invert",
|
||||
"GL_MESA_resize_buffers",
|
||||
"GL_MESA_ycbcr_texture",
|
||||
"GL_NV_blend_square",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: get.c,v 1.90 2002/09/06 13:00:50 brianp Exp $ */
|
||||
/* $Id: get.c,v 1.91 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -659,6 +659,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||
*params = ctx->Pack.ImageHeight;
|
||||
break;
|
||||
case GL_PACK_INVERT_MESA:
|
||||
*params = ctx->Pack.Invert;
|
||||
break;
|
||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||
*params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
|
||||
break;
|
||||
@@ -2018,6 +2021,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||
*params = (GLdouble) ctx->Pack.ImageHeight;
|
||||
break;
|
||||
case GL_PACK_INVERT_MESA:
|
||||
*params = (GLdouble) ctx->Pack.Invert;
|
||||
break;
|
||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||
*params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
|
||||
break;
|
||||
@@ -3374,6 +3380,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||
*params = (GLfloat) ctx->Pack.ImageHeight;
|
||||
break;
|
||||
case GL_PACK_INVERT_MESA:
|
||||
*params = (GLfloat) ctx->Pack.Invert;
|
||||
break;
|
||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||
*params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
|
||||
break;
|
||||
@@ -4707,6 +4716,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||
*params = ctx->Pack.ImageHeight;
|
||||
break;
|
||||
case GL_PACK_INVERT_MESA:
|
||||
*params = ctx->Pack.Invert;
|
||||
break;
|
||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||
*params = (GLint) ctx->Hint.PerspectiveCorrection;
|
||||
break;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: image.c,v 1.67 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: image.c,v 1.68 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -58,7 +58,8 @@ const struct gl_pixelstore_attrib _mesa_native_packing = {
|
||||
0, /* SkipImages */
|
||||
GL_FALSE, /* SwapBytes */
|
||||
GL_FALSE, /* LsbFirst */
|
||||
GL_FALSE /* ClientStorage */
|
||||
GL_FALSE, /* ClientStorage */
|
||||
GL_FALSE /* Invert */
|
||||
};
|
||||
|
||||
|
||||
@@ -494,6 +495,7 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing,
|
||||
else {
|
||||
/* Non-BITMAP data */
|
||||
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
|
||||
GLint topOfImage;
|
||||
|
||||
bytes_per_pixel = _mesa_bytes_per_pixel( format, type );
|
||||
|
||||
@@ -509,9 +511,19 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing,
|
||||
|
||||
bytes_per_image = bytes_per_row * rows_per_image;
|
||||
|
||||
if (packing->Invert) {
|
||||
/* set pixel_addr to the last row */
|
||||
topOfImage = bytes_per_row * (height - 1);
|
||||
bytes_per_row = -bytes_per_row;
|
||||
}
|
||||
else {
|
||||
topOfImage = 0;
|
||||
}
|
||||
|
||||
/* compute final pixel address */
|
||||
pixel_addr = (GLubyte *) image
|
||||
+ (skipimages + img) * bytes_per_image
|
||||
+ topOfImage
|
||||
+ (skiprows + row) * bytes_per_row
|
||||
+ (skippixels + column) * bytes_per_pixel;
|
||||
}
|
||||
@@ -532,14 +544,18 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
|
||||
ASSERT(packing);
|
||||
if (type == GL_BITMAP) {
|
||||
/* BITMAP data */
|
||||
GLint bytes;
|
||||
if (packing->RowLength == 0) {
|
||||
GLint bytes = (width + 7) / 8;
|
||||
return bytes;
|
||||
bytes = (width + 7) / 8;
|
||||
}
|
||||
else {
|
||||
GLint bytes = (packing->RowLength + 7) / 8;
|
||||
return bytes;
|
||||
bytes = (packing->RowLength + 7) / 8;
|
||||
}
|
||||
if (packing->Invert) {
|
||||
/* negate the bytes per row (negative row stride) */
|
||||
bytes = -bytes;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
else {
|
||||
/* Non-BITMAP data */
|
||||
@@ -556,6 +572,8 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
|
||||
remainder = bytesPerRow % packing->Alignment;
|
||||
if (remainder > 0)
|
||||
bytesPerRow += (packing->Alignment - remainder);
|
||||
if (packing->Invert)
|
||||
bytesPerRow = -bytesPerRow;
|
||||
return bytesPerRow;
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: mtypes.h,v 1.86 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: mtypes.h,v 1.87 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -1045,6 +1045,7 @@ struct gl_pixelstore_attrib {
|
||||
GLboolean SwapBytes;
|
||||
GLboolean LsbFirst;
|
||||
GLboolean ClientStorage; /* GL_APPLE_client_storage */
|
||||
GLboolean Invert; /* GL_MESA_pack_invert */
|
||||
};
|
||||
|
||||
|
||||
@@ -1434,6 +1435,7 @@ struct gl_extensions {
|
||||
GLboolean HP_occlusion_test;
|
||||
GLboolean IBM_rasterpos_clip;
|
||||
GLboolean INGR_blend_func_separate;
|
||||
GLboolean MESA_pack_invert;
|
||||
GLboolean MESA_window_pos;
|
||||
GLboolean MESA_resize_buffers;
|
||||
GLboolean MESA_ycbcr_texture;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: pixel.c,v 1.35 2002/09/21 16:51:25 brianp Exp $ */
|
||||
/* $Id: pixel.c,v 1.36 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -146,6 +146,17 @@ _mesa_PixelStorei( GLenum pname, GLint param )
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Pack.Alignment = param;
|
||||
break;
|
||||
case GL_PACK_INVERT_MESA:
|
||||
if (!ctx->Extensions.MESA_pack_invert) {
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Pack.Invert == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Pack.Invert = param;
|
||||
break;
|
||||
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
if (param == (GLint)ctx->Unpack.SwapBytes)
|
||||
return;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: s_readpix.c,v 1.15 2002/07/09 01:22:52 brianp Exp $ */
|
||||
/* $Id: s_readpix.c,v 1.16 2002/09/21 17:34:56 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -281,6 +281,13 @@ read_fast_rgba_pixels( GLcontext *ctx,
|
||||
GLchan *dest = (GLchan *) pixels
|
||||
+ (skipRows * rowLength + skipPixels) * 4;
|
||||
GLint row;
|
||||
|
||||
if (packing->Invert) {
|
||||
/* start at top and go down */
|
||||
dest += (readHeight - 1) * rowLength * 4;
|
||||
rowLength = -rowLength;
|
||||
}
|
||||
|
||||
for (row=0; row<readHeight; row++) {
|
||||
(*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
|
||||
(GLchan (*)[4]) dest);
|
||||
|
Reference in New Issue
Block a user