summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-11-10 15:46:52 +0000
committerBrian Paul <[email protected]>2004-11-10 15:46:52 +0000
commit60909388ab136d849d99eab49e782a53772a618f (patch)
tree84a981ea2e79b5e6477d05991119a23efa4429a5 /src/mesa/drivers
parentf00d7edd746e4d1eec2d497419f21fb3b04f8bd4 (diff)
GL_(UN)PACK_SKIP_IMAGES should only be applied to 3D texture pack/unpacking
and ignored for 1D and 2D images. Need to pass in image dimensions (1,2,3) to the _mesa_image_address() function. This change gets propogated to some other routines. Also added new _mesa_image_address[123]d() convenience functions.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c8
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_pixels.c28
-rw-r--r--src/mesa/drivers/glide/fxdd.c68
-rw-r--r--src/mesa/drivers/x11/xm_dd.c4
5 files changed, 52 insertions, 60 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 7fb91a0730b..43f83650781 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -839,8 +839,8 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
*/
for (row=0; row<height; row++) {
const GLubyte *src = (const GLubyte *)
- _mesa_image_address( unpack, bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
+ _mesa_image_address2d(unpack, bitmap, width, height,
+ GL_COLOR_INDEX, GL_BITMAP, row, 0 );
if (unpack->LsbFirst) {
/* Lsb first */
diff --git a/src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c b/src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c
index cb4a5142219..3ac20bd7b71 100644
--- a/src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c
+++ b/src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c
@@ -146,8 +146,8 @@ radeonPointsBitmap( GLsizei width, GLsizei height,
if (ctx->_RotateMode) {
for (col=0; col<width; col++) {
const GLubyte *src = (const GLubyte *)
- _mesa_image_address( unpack, bitmap, height, width,
- GL_COLOR_INDEX, GL_BITMAP, 0, col, 0 );
+ _mesa_image_address2d(unpack, bitmap, height, width,
+ GL_COLOR_INDEX, GL_BITMAP, col, 0 );
/* Msb first */
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
@@ -166,8 +166,8 @@ radeonPointsBitmap( GLsizei width, GLsizei height,
else {
for (row=0; row<height; row++) {
const GLubyte *src = (const GLubyte *)
- _mesa_image_address( unpack, bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
+ _mesa_image_address2d(unpack, bitmap, width, height,
+ GL_COLOR_INDEX, GL_BITMAP, row, 0 );
/* Msb first */
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
index aaee401d7ab..7ec6302cf15 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
@@ -264,10 +264,10 @@ tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
for (row = 0; row < height; row++) {
const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX,
- GL_BITMAP, 0, row, 0);
+ (const GLubyte *) _mesa_image_address2d(finalUnpack,
+ bitmap, width, height,
+ GL_COLOR_INDEX,
+ GL_BITMAP, row, 0);
if (finalUnpack->LsbFirst) {
/* least significan bit first */
GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
@@ -423,10 +423,10 @@ tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
/* compute dest address of bottom-left pixel in bitmap */
for (row = 0; row < height; row++) {
const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX,
- GL_BITMAP, 0, row, 0);
+ (const GLubyte *) _mesa_image_address2d(finalUnpack,
+ bitmap, width, height,
+ GL_COLOR_INDEX,
+ GL_BITMAP, row, 0);
if (finalUnpack->LsbFirst) {
/* least significan bit first */
GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
@@ -512,8 +512,8 @@ tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2);
const GLushort *src = (const GLushort *) info.lfbPtr
+ scrY * srcStride + scrX;
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
- dstImage, width, height, format, type, 0, 0, 0);
+ GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing,
+ dstImage, width, height, format, type, 0, 0);
const GLint dstStride = _mesa_image_row_stride(packing,
width, format, type);
@@ -573,8 +573,8 @@ tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
+ scrY * srcStride + scrX;
const GLint dstStride =
_mesa_image_row_stride(packing, width, format, type);
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing,
- dstImage, width, height, format, type, 0, 0, 0);
+ GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing,
+ dstImage, width, height, format, type, 0, 0);
const GLint widthInBytes = width * 4;
{
@@ -667,8 +667,8 @@ tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
+ scrY * dstStride + scrX * 4;
const GLint srcStride =
_mesa_image_row_stride(unpack, width, format, type);
- const GLubyte *src = (GLubyte *) _mesa_image_address(unpack,
- pixels, width, height, format, type, 0, 0, 0);
+ const GLubyte *src = (GLubyte *) _mesa_image_address2d(unpack,
+ pixels, width, height, format, type, 0, 0);
const GLint widthInBytes = width * 4;
if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) ||
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 74d0dc008ca..69c1d7e51ab 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -525,10 +525,10 @@ fxDDDrawBitmap2 (GLcontext *ctx, GLint px, GLint py,
for (row = 0; row < height; row++) {
const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- 0, row, 0);
+ (const GLubyte *) _mesa_image_address2d(finalUnpack,
+ bitmap, width, height,
+ GL_COLOR_INDEX, GL_BITMAP,
+ row, 0);
if (finalUnpack->LsbFirst) {
/* least significan bit first */
GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
@@ -684,10 +684,10 @@ fxDDDrawBitmap4 (GLcontext *ctx, GLint px, GLint py,
for (row = 0; row < height; row++) {
const GLubyte *src =
- (const GLubyte *) _mesa_image_address(finalUnpack,
- bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- 0, row, 0);
+ (const GLubyte *) _mesa_image_address2d(finalUnpack,
+ bitmap, width, height,
+ GL_COLOR_INDEX, GL_BITMAP,
+ row, 0);
if (finalUnpack->LsbFirst) {
/* least significan bit first */
GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
@@ -762,9 +762,9 @@ fxDDReadPixels565 (GLcontext * ctx,
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLushort *src = (const GLushort *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage,
+ GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
width, height, format,
- type, 0, 0, 0);
+ type, 0, 0);
GLint dstStride =
_mesa_image_row_stride(packing, width, format, type);
@@ -875,9 +875,9 @@ fxDDReadPixels555 (GLcontext * ctx,
const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
const GLushort *src = (const GLushort *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage,
+ GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
width, height, format,
- type, 0, 0, 0);
+ type, 0, 0);
GLint dstStride =
_mesa_image_row_stride(packing, width, format, type);
@@ -988,9 +988,9 @@ fxDDReadPixels8888 (GLcontext * ctx,
const GLint srcStride = info.strideInBytes / 4; /* stride in GLuints */
const GLuint *src = (const GLuint *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
- GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage,
+ GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dstImage,
width, height, format,
- type, 0, 0, 0);
+ type, 0, 0);
GLint dstStride =
_mesa_image_row_stride(packing, width, format, type);
@@ -1155,9 +1155,8 @@ fxDDDrawPixels555 (GLcontext * ctx, GLint x, GLint y,
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR1555(src[2], src[1], src[0], src[3]);
@@ -1169,9 +1168,8 @@ fxDDDrawPixels555 (GLcontext * ctx, GLint x, GLint y,
else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR1555(src[2], src[1], src[0], 255);
@@ -1292,9 +1290,8 @@ fxDDDrawPixels565 (GLcontext * ctx, GLint x, GLint y,
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR565(src[2], src[1], src[0]);
@@ -1306,9 +1303,8 @@ fxDDDrawPixels565 (GLcontext * ctx, GLint x, GLint y,
else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR565(src[2], src[1], src[0]);
@@ -1429,9 +1425,8 @@ fxDDDrawPixels565_rev (GLcontext * ctx, GLint x, GLint y,
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR565(src[0], src[1], src[2]);
@@ -1443,9 +1438,8 @@ fxDDDrawPixels565_rev (GLcontext * ctx, GLint x, GLint y,
else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR565(src[0], src[1], src[2]);
@@ -1568,9 +1562,8 @@ fxDDDrawPixels8888 (GLcontext * ctx, GLint x, GLint y,
const GLint widthInBytes = width * 4;
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, row, 0);
MEMCPY(dst, src, widthInBytes);
dst += dstStride;
}
@@ -1578,9 +1571,8 @@ fxDDDrawPixels8888 (GLcontext * ctx, GLint x, GLint y,
else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
GLint row;
for (row = 0; row < height; row++) {
- GLubyte *src = (GLubyte *) _mesa_image_address(finalUnpack, pixels,
- width, height, format,
- type, 0, row, 0);
+ GLubyte *src = (GLubyte *) _mesa_image_address2d(finalUnpack,
+ pixels, width, height, format, type, 0, row, 0);
GLint col;
for (col = 0; col < width; col++) {
dst[col] = TDFXPACKCOLOR8888(src[2], src[1], src[0], 255);
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index bee46a53a8d..cbdcd99b39d 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -846,7 +846,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
if (unpack->BufferObj->Name) {
/* unpack from PBO */
GLubyte *buf;
- if (!_mesa_validate_pbo_access(unpack, width, height, 1,
+ if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
@@ -949,7 +949,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
if (unpack->BufferObj->Name) {
/* unpack from PBO */
GLubyte *buf;
- if (!_mesa_validate_pbo_access(unpack, width, height, 1,
+ if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");