aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/mipmap.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-02 14:47:58 +0000
committermarha <marha@users.sourceforge.net>2010-04-02 14:47:58 +0000
commit7933658107276f9d5491f8736a743cf8f8bbd5f2 (patch)
treef2893a761364e7abc9d934e9c5427e5cf5190c7a /mesalib/src/mesa/main/mipmap.c
parent83fa9a9811e2c18cffd83a020757f7fb51ffddaa (diff)
downloadvcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.tar.gz
vcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.tar.bz2
vcxsrv-7933658107276f9d5491f8736a743cf8f8bbd5f2.zip
Updated to following packages:
mesa-7.8
Diffstat (limited to 'mesalib/src/mesa/main/mipmap.c')
-rw-r--r--mesalib/src/mesa/main/mipmap.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 7350c7a3d..51f7edfab 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -30,7 +30,6 @@
#include "imports.h"
#include "formats.h"
#include "mipmap.h"
-#include "texcompress.h"
#include "teximage.h"
#include "texstore.h"
#include "image.h"
@@ -980,9 +979,11 @@ make_1d_mipmap(GLenum datatype, GLuint comps, GLint border,
if (border) {
/* copy left-most pixel from source */
- MEMCPY(dstPtr, srcPtr, bpt);
+ assert(dstPtr);
+ assert(srcPtr);
+ memcpy(dstPtr, srcPtr, bpt);
/* copy right-most pixel from source */
- MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth - 1) * bpt,
srcPtr + (srcWidth - 1) * bpt,
bpt);
}
@@ -1026,15 +1027,17 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border,
if (border > 0) {
/* fill in dest border */
/* lower-left border pixel */
- MEMCPY(dstPtr, srcPtr, bpt);
+ assert(dstPtr);
+ assert(srcPtr);
+ memcpy(dstPtr, srcPtr, bpt);
/* lower-right border pixel */
- MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth - 1) * bpt,
srcPtr + (srcWidth - 1) * bpt, bpt);
/* upper-left border pixel */
- MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt,
+ memcpy(dstPtr + dstWidth * (dstHeight - 1) * bpt,
srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt);
/* upper-right border pixel */
- MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt,
+ memcpy(dstPtr + (dstWidth * dstHeight - 1) * bpt,
srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt);
/* lower border */
do_row(datatype, comps, srcWidthNB,
@@ -1051,9 +1054,9 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border,
if (srcHeight == dstHeight) {
/* copy border pixel from src to dst */
for (row = 1; row < srcHeight; row++) {
- MEMCPY(dstPtr + dstWidth * row * bpt,
+ memcpy(dstPtr + dstWidth * row * bpt,
srcPtr + srcWidth * row * bpt, bpt);
- MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt);
}
}
@@ -1116,7 +1119,7 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
*/
/*
- _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n",
+ printf("mip3d %d x %d x %d -> %d x %d x %d\n",
srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth);
*/
@@ -1175,28 +1178,28 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
/* do border along [img][row=0][col=0] */
src = srcPtr + (img + 1) * bytesPerSrcImage;
dst = dstPtr + (img + 1) * bytesPerDstImage;
- MEMCPY(dst, src, bpt);
+ memcpy(dst, src, bpt);
/* do border along [img][row=dstHeight-1][col=0] */
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ (srcHeight - 1) * bytesPerSrcRow;
dst = dstPtr + (img + 1) * bytesPerDstImage
+ (dstHeight - 1) * bytesPerDstRow;
- MEMCPY(dst, src, bpt);
+ memcpy(dst, src, bpt);
/* do border along [img][row=0][col=dstWidth-1] */
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ (srcWidth - 1) * bpt;
dst = dstPtr + (img + 1) * bytesPerDstImage
+ (dstWidth - 1) * bpt;
- MEMCPY(dst, src, bpt);
+ memcpy(dst, src, bpt);
/* do border along [img][row=dstHeight-1][col=dstWidth-1] */
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ (bytesPerSrcImage - bpt);
dst = dstPtr + (img + 1) * bytesPerDstImage
+ (bytesPerDstImage - bpt);
- MEMCPY(dst, src, bpt);
+ memcpy(dst, src, bpt);
}
}
else {
@@ -1266,9 +1269,11 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
if (border) {
/* copy left-most pixel from source */
- MEMCPY(dstPtr, srcPtr, bpt);
+ assert(dstPtr);
+ assert(srcPtr);
+ memcpy(dstPtr, srcPtr, bpt);
/* copy right-most pixel from source */
- MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth - 1) * bpt,
srcPtr + (srcWidth - 1) * bpt,
bpt);
}
@@ -1320,15 +1325,17 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
if (border > 0) {
/* fill in dest border */
/* lower-left border pixel */
- MEMCPY(dstPtr, srcPtr, bpt);
+ assert(dstPtr);
+ assert(srcPtr);
+ memcpy(dstPtr, srcPtr, bpt);
/* lower-right border pixel */
- MEMCPY(dstPtr + (dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth - 1) * bpt,
srcPtr + (srcWidth - 1) * bpt, bpt);
/* upper-left border pixel */
- MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt,
+ memcpy(dstPtr + dstWidth * (dstHeight - 1) * bpt,
srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt);
/* upper-right border pixel */
- MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt,
+ memcpy(dstPtr + (dstWidth * dstHeight - 1) * bpt,
srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt);
/* lower border */
do_row(datatype, comps, srcWidthNB,
@@ -1345,9 +1352,9 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
if (srcHeight == dstHeight) {
/* copy border pixel from src to dst */
for (row = 1; row < srcHeight; row++) {
- MEMCPY(dstPtr + dstWidth * row * bpt,
+ memcpy(dstPtr + dstWidth * row * bpt,
srcPtr + srcWidth * row * bpt, bpt);
- MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
+ memcpy(dstPtr + (dstWidth * row + dstWidth - 1) * bpt,
srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt);
}
}
@@ -1538,15 +1545,15 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE)
* srcImage->Width * srcImage->Height * srcImage->Depth + 20;
/* 20 extra bytes, just be safe when calling last FetchTexel */
- srcData = (GLubyte *) _mesa_malloc(size);
+ srcData = (GLubyte *) malloc(size);
if (!srcData) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
return;
}
- dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */
+ dstData = (GLubyte *) malloc(size / 2); /* 1/4 would probably be OK */
if (!dstData) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- _mesa_free((void *) srcData);
+ free((void *) srcData);
return;
}
@@ -1591,8 +1598,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
if (!nextLevel) {
/* all done */
if (_mesa_is_format_compressed(srcImage->TexFormat)) {
- _mesa_free((void *) srcData);
- _mesa_free(dstData);
+ free((void *) srcData);
+ free(dstData);
}
return;
}