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
|
* Mesa 3-D graphics library
|
||||||
@@ -111,6 +111,7 @@ static struct {
|
|||||||
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
|
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
|
||||||
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
|
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
|
||||||
{ OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) },
|
{ 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_packed_depth_stencil", 0 },
|
||||||
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
|
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
|
||||||
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
|
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
|
||||||
@@ -183,6 +184,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
|
|||||||
"GL_HP_occlusion_test",
|
"GL_HP_occlusion_test",
|
||||||
"GL_IBM_texture_mirrored_repeat",
|
"GL_IBM_texture_mirrored_repeat",
|
||||||
"GL_INGR_blend_func_separate",
|
"GL_INGR_blend_func_separate",
|
||||||
|
"GL_MESA_pack_invert",
|
||||||
"GL_MESA_resize_buffers",
|
"GL_MESA_resize_buffers",
|
||||||
"GL_MESA_ycbcr_texture",
|
"GL_MESA_ycbcr_texture",
|
||||||
"GL_NV_blend_square",
|
"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
|
* Mesa 3-D graphics library
|
||||||
@@ -659,6 +659,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||||
*params = ctx->Pack.ImageHeight;
|
*params = ctx->Pack.ImageHeight;
|
||||||
break;
|
break;
|
||||||
|
case GL_PACK_INVERT_MESA:
|
||||||
|
*params = ctx->Pack.Invert;
|
||||||
|
break;
|
||||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||||
*params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
|
*params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
|
||||||
break;
|
break;
|
||||||
@@ -2018,6 +2021,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||||
*params = (GLdouble) ctx->Pack.ImageHeight;
|
*params = (GLdouble) ctx->Pack.ImageHeight;
|
||||||
break;
|
break;
|
||||||
|
case GL_PACK_INVERT_MESA:
|
||||||
|
*params = (GLdouble) ctx->Pack.Invert;
|
||||||
|
break;
|
||||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||||
*params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
|
*params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
|
||||||
break;
|
break;
|
||||||
@@ -3374,6 +3380,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||||
*params = (GLfloat) ctx->Pack.ImageHeight;
|
*params = (GLfloat) ctx->Pack.ImageHeight;
|
||||||
break;
|
break;
|
||||||
|
case GL_PACK_INVERT_MESA:
|
||||||
|
*params = (GLfloat) ctx->Pack.Invert;
|
||||||
|
break;
|
||||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||||
*params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
|
*params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
|
||||||
break;
|
break;
|
||||||
@@ -4707,6 +4716,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||||||
case GL_PACK_IMAGE_HEIGHT_EXT:
|
case GL_PACK_IMAGE_HEIGHT_EXT:
|
||||||
*params = ctx->Pack.ImageHeight;
|
*params = ctx->Pack.ImageHeight;
|
||||||
break;
|
break;
|
||||||
|
case GL_PACK_INVERT_MESA:
|
||||||
|
*params = ctx->Pack.Invert;
|
||||||
|
break;
|
||||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||||
*params = (GLint) ctx->Hint.PerspectiveCorrection;
|
*params = (GLint) ctx->Hint.PerspectiveCorrection;
|
||||||
break;
|
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
|
* Mesa 3-D graphics library
|
||||||
@@ -58,7 +58,8 @@ const struct gl_pixelstore_attrib _mesa_native_packing = {
|
|||||||
0, /* SkipImages */
|
0, /* SkipImages */
|
||||||
GL_FALSE, /* SwapBytes */
|
GL_FALSE, /* SwapBytes */
|
||||||
GL_FALSE, /* LsbFirst */
|
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 {
|
else {
|
||||||
/* Non-BITMAP data */
|
/* Non-BITMAP data */
|
||||||
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
|
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image;
|
||||||
|
GLint topOfImage;
|
||||||
|
|
||||||
bytes_per_pixel = _mesa_bytes_per_pixel( format, type );
|
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;
|
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 */
|
/* compute final pixel address */
|
||||||
pixel_addr = (GLubyte *) image
|
pixel_addr = (GLubyte *) image
|
||||||
+ (skipimages + img) * bytes_per_image
|
+ (skipimages + img) * bytes_per_image
|
||||||
|
+ topOfImage
|
||||||
+ (skiprows + row) * bytes_per_row
|
+ (skiprows + row) * bytes_per_row
|
||||||
+ (skippixels + column) * bytes_per_pixel;
|
+ (skippixels + column) * bytes_per_pixel;
|
||||||
}
|
}
|
||||||
@@ -532,14 +544,18 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
|
|||||||
ASSERT(packing);
|
ASSERT(packing);
|
||||||
if (type == GL_BITMAP) {
|
if (type == GL_BITMAP) {
|
||||||
/* BITMAP data */
|
/* BITMAP data */
|
||||||
|
GLint bytes;
|
||||||
if (packing->RowLength == 0) {
|
if (packing->RowLength == 0) {
|
||||||
GLint bytes = (width + 7) / 8;
|
bytes = (width + 7) / 8;
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GLint bytes = (packing->RowLength + 7) / 8;
|
bytes = (packing->RowLength + 7) / 8;
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
|
if (packing->Invert) {
|
||||||
|
/* negate the bytes per row (negative row stride) */
|
||||||
|
bytes = -bytes;
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Non-BITMAP data */
|
/* Non-BITMAP data */
|
||||||
@@ -556,6 +572,8 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
|
|||||||
remainder = bytesPerRow % packing->Alignment;
|
remainder = bytesPerRow % packing->Alignment;
|
||||||
if (remainder > 0)
|
if (remainder > 0)
|
||||||
bytesPerRow += (packing->Alignment - remainder);
|
bytesPerRow += (packing->Alignment - remainder);
|
||||||
|
if (packing->Invert)
|
||||||
|
bytesPerRow = -bytesPerRow;
|
||||||
return 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
|
* Mesa 3-D graphics library
|
||||||
@@ -1045,6 +1045,7 @@ struct gl_pixelstore_attrib {
|
|||||||
GLboolean SwapBytes;
|
GLboolean SwapBytes;
|
||||||
GLboolean LsbFirst;
|
GLboolean LsbFirst;
|
||||||
GLboolean ClientStorage; /* GL_APPLE_client_storage */
|
GLboolean ClientStorage; /* GL_APPLE_client_storage */
|
||||||
|
GLboolean Invert; /* GL_MESA_pack_invert */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1434,6 +1435,7 @@ struct gl_extensions {
|
|||||||
GLboolean HP_occlusion_test;
|
GLboolean HP_occlusion_test;
|
||||||
GLboolean IBM_rasterpos_clip;
|
GLboolean IBM_rasterpos_clip;
|
||||||
GLboolean INGR_blend_func_separate;
|
GLboolean INGR_blend_func_separate;
|
||||||
|
GLboolean MESA_pack_invert;
|
||||||
GLboolean MESA_window_pos;
|
GLboolean MESA_window_pos;
|
||||||
GLboolean MESA_resize_buffers;
|
GLboolean MESA_resize_buffers;
|
||||||
GLboolean MESA_ycbcr_texture;
|
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
|
* Mesa 3-D graphics library
|
||||||
@@ -146,6 +146,17 @@ _mesa_PixelStorei( GLenum pname, GLint param )
|
|||||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||||
ctx->Pack.Alignment = param;
|
ctx->Pack.Alignment = param;
|
||||||
break;
|
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:
|
case GL_UNPACK_SWAP_BYTES:
|
||||||
if (param == (GLint)ctx->Unpack.SwapBytes)
|
if (param == (GLint)ctx->Unpack.SwapBytes)
|
||||||
return;
|
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
|
* Mesa 3-D graphics library
|
||||||
@@ -281,6 +281,13 @@ read_fast_rgba_pixels( GLcontext *ctx,
|
|||||||
GLchan *dest = (GLchan *) pixels
|
GLchan *dest = (GLchan *) pixels
|
||||||
+ (skipRows * rowLength + skipPixels) * 4;
|
+ (skipRows * rowLength + skipPixels) * 4;
|
||||||
GLint row;
|
GLint row;
|
||||||
|
|
||||||
|
if (packing->Invert) {
|
||||||
|
/* start at top and go down */
|
||||||
|
dest += (readHeight - 1) * rowLength * 4;
|
||||||
|
rowLength = -rowLength;
|
||||||
|
}
|
||||||
|
|
||||||
for (row=0; row<readHeight; row++) {
|
for (row=0; row<readHeight; row++) {
|
||||||
(*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
|
(*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
|
||||||
(GLchan (*)[4]) dest);
|
(GLchan (*)[4]) dest);
|
||||||
|
Reference in New Issue
Block a user