aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/image.c')
-rw-r--r--mesalib/src/mesa/main/image.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 139e56a96..dc8d97728 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -33,10 +33,10 @@
#include "glheader.h"
#include "colormac.h"
#include "context.h"
+#include "enums.h"
#include "image.h"
#include "imports.h"
#include "macros.h"
-#include "pixel.h"
/**
@@ -1038,7 +1038,7 @@ _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
| (p[3] );
p += 4;
}
- _mesa_free(ptrn);
+ free(ptrn);
}
}
@@ -1083,7 +1083,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) _mesa_malloc( bytes );
+ buffer = (GLubyte *) malloc( bytes );
if (!buffer)
return NULL;
@@ -1094,12 +1094,12 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
_mesa_image_address2d(packing, pixels, width, height,
GL_COLOR_INDEX, GL_BITMAP, row, 0);
if (!src) {
- _mesa_free(buffer);
+ free(buffer);
return NULL;
}
if ((packing->SkipPixels & 7) == 0) {
- _mesa_memcpy( dst, src, width_in_bytes );
+ memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
}
@@ -1191,7 +1191,7 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
return;
if ((packing->SkipPixels & 7) == 0) {
- _mesa_memcpy( dst, src, width_in_bytes );
+ memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
}
@@ -3228,6 +3228,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
srcFormat == GL_RGBA ||
srcFormat == GL_BGRA ||
srcFormat == GL_ABGR_EXT ||
+ srcFormat == GL_DU8DV8_ATI ||
srcFormat == GL_DUDV_ATI);
ASSERT(srcType == GL_UNSIGNED_BYTE ||
@@ -3343,6 +3344,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
aComp = 0;
stride = 4;
break;
+ case GL_DU8DV8_ATI:
case GL_DUDV_ATI:
redIndex = 0;
greenIndex = 1;
@@ -3351,7 +3353,8 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
stride = 2;
break;
default:
- _mesa_problem(NULL, "bad srcFormat in extract float data");
+ _mesa_problem(NULL, "bad srcFormat %s in extract float data",
+ _mesa_lookup_enum_by_nr(srcFormat));
return;
}
@@ -3791,7 +3794,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
if (srcType == CHAN_TYPE) {
if (dstFormat == GL_RGBA) {
if (srcFormat == GL_RGBA) {
- _mesa_memcpy( dest, source, n * 4 * sizeof(GLchan) );
+ memcpy( dest, source, n * 4 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGB) {
@@ -3811,7 +3814,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
}
else if (dstFormat == GL_RGB) {
if (srcFormat == GL_RGB) {
- _mesa_memcpy( dest, source, n * 3 * sizeof(GLchan) );
+ memcpy( dest, source, n * 3 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGBA) {
@@ -3831,7 +3834,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
else if (dstFormat == srcFormat) {
GLint comps = _mesa_components_in_format(srcFormat);
assert(comps > 0);
- _mesa_memcpy( dest, source, n * comps * sizeof(GLchan) );
+ memcpy( dest, source, n * comps * sizeof(GLchan) );
return;
}
}
@@ -4378,11 +4381,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
*/
if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE
&& dstType == GL_UNSIGNED_BYTE) {
- _mesa_memcpy(dest, source, n * sizeof(GLubyte));
+ memcpy(dest, source, n * sizeof(GLubyte));
}
else if (transferOps == 0 && srcType == GL_UNSIGNED_INT
&& dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) {
- _mesa_memcpy(dest, source, n * sizeof(GLuint));
+ memcpy(dest, source, n * sizeof(GLuint));
}
else {
/*
@@ -4418,7 +4421,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_UNSIGNED_INT:
- _mesa_memcpy(dest, indexes, n * sizeof(GLuint));
+ memcpy(dest, indexes, n * sizeof(GLuint));
break;
default:
_mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span");
@@ -4441,7 +4444,7 @@ _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) {
/* make a copy of input */
- _mesa_memcpy(indexes, source, n * sizeof(GLuint));
+ memcpy(indexes, source, n * sizeof(GLuint));
_mesa_apply_ci_transfer_ops(ctx, transferOps, n, indexes);
source = indexes;
}
@@ -4589,14 +4592,14 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
!ctx->Pixel.MapStencilFlag &&
srcType == GL_UNSIGNED_BYTE &&
dstType == GL_UNSIGNED_BYTE) {
- _mesa_memcpy(dest, source, n * sizeof(GLubyte));
+ memcpy(dest, source, n * sizeof(GLubyte));
}
else if (transferOps == 0 &&
!ctx->Pixel.MapStencilFlag &&
srcType == GL_UNSIGNED_INT &&
dstType == GL_UNSIGNED_INT &&
!srcPacking->SwapBytes) {
- _mesa_memcpy(dest, source, n * sizeof(GLuint));
+ memcpy(dest, source, n * sizeof(GLuint));
}
else {
/*
@@ -4643,7 +4646,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_UNSIGNED_INT:
- _mesa_memcpy(dest, indexes, n * sizeof(GLuint));
+ memcpy(dest, indexes, n * sizeof(GLuint));
break;
default:
_mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span");
@@ -4664,7 +4667,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
ctx->Pixel.MapStencilFlag) {
/* make a copy of input */
- _mesa_memcpy(stencil, source, n * sizeof(GLstencil));
+ memcpy(stencil, source, n * sizeof(GLstencil));
_mesa_apply_stencil_transfer_ops(ctx, n, stencil);
source = stencil;
}
@@ -4672,7 +4675,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
switch (dstType) {
case GL_UNSIGNED_BYTE:
if (sizeof(GLstencil) == 1) {
- _mesa_memcpy( dest, source, n );
+ memcpy( dest, source, n );
}
else {
GLubyte *dst = (GLubyte *) dest;
@@ -5036,7 +5039,7 @@ _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
ASSERT(n <= MAX_WIDTH);
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
- _mesa_memcpy(depthCopy, depthSpan, n * sizeof(GLfloat));
+ memcpy(depthCopy, depthSpan, n * sizeof(GLfloat));
_mesa_scale_and_bias_depth(ctx, n, depthCopy);
depthSpan = depthCopy;
}
@@ -5155,7 +5158,7 @@ _mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
ASSERT(n <= MAX_WIDTH);
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
- _mesa_memcpy(depthCopy, depthVals, n * sizeof(GLfloat));
+ memcpy(depthCopy, depthVals, n * sizeof(GLfloat));
_mesa_scale_and_bias_depth(ctx, n, depthCopy);
depthVals = depthCopy;
}
@@ -5163,7 +5166,7 @@ _mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
if (ctx->Pixel.IndexShift ||
ctx->Pixel.IndexOffset ||
ctx->Pixel.MapStencilFlag) {
- _mesa_memcpy(stencilCopy, stencilVals, n * sizeof(GLstencil));
+ memcpy(stencilCopy, stencilVals, n * sizeof(GLstencil));
_mesa_apply_stencil_transfer_ops(ctx, n, stencilCopy);
stencilVals = stencilCopy;
}
@@ -5229,7 +5232,7 @@ _mesa_unpack_image( GLuint dimensions,
{
GLubyte *destBuffer
- = (GLubyte *) _mesa_malloc(bytesPerRow * height * depth);
+ = (GLubyte *) malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)
@@ -5300,7 +5303,7 @@ _mesa_unpack_image( GLuint dimensions,
}
}
else {
- _mesa_memcpy(dst, src, bytesPerRow);
+ memcpy(dst, src, bytesPerRow);
}
/* byte flipping/swapping */
@@ -5353,7 +5356,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLushort));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLushort));
}
else {
const GLubyte (*src1)[4] = (const GLubyte (*)[4]) src;
@@ -5369,7 +5372,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLfloat));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLfloat));
}
break;
case GL_UNSIGNED_SHORT:
@@ -5386,7 +5389,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLubyte));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLubyte));
}
else {
const GLushort (*src2)[4] = (const GLushort (*)[4]) src;
@@ -5402,7 +5405,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLfloat));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLfloat));
}
break;
case GL_FLOAT:
@@ -5419,7 +5422,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLubyte));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLubyte));
}
else {
const GLfloat (*src4)[4] = (const GLfloat (*)[4]) src;
@@ -5435,7 +5438,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
}
}
if (useTemp)
- _mesa_memcpy(dst, tempBuffer, count * 4 * sizeof(GLushort));
+ memcpy(dst, tempBuffer, count * 4 * sizeof(GLushort));
}
break;
default:
@@ -5659,7 +5662,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = maxValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX0 > maxValue) {
@@ -5669,7 +5672,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = maxValue;
- bias = (*srcX0 < *srcX1) ? -0.5 : 0.5;
+ bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F;
*srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
@@ -5692,7 +5695,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5; /* flipped??? */
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; /* flipped??? */
*srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX1 < minValue) {
@@ -5702,7 +5705,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}