-/* $Id: attrib.c,v 1.29 2000/10/28 18:34:48 brianp Exp $ */
+/* $Id: attrib.c,v 1.30 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "context.h"
#include "enable.h"
#include "enums.h"
+#include "matrix.h"
#include "mem.h"
#include "simple_list.h"
#include "texstate.h"
-/* $Id: colormac.h,v 1.1 2000/10/28 20:41:13 brianp Exp $ */
+/* $Id: colormac.h,v 1.2 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
#define FLOAT_TO_CHAN(f) (f)
#define DOUBLE_TO_CHAN(f) ((GLfloat) (f))
+#define UNCLAMPED_FLOAT_TO_CHAN(f) (f)
+#define UNCLAMPED_DOUBLE_TO_CHAN(f) ((GLfloat) (f))
#else
#define FLOAT_TO_CHAN(f) ( (GLchan) FloatToInt((f) * CHAN_MAXF + 0.5F) )
#define DOUBLE_TO_CHAN(f) ( (GLchan) FloatToInt((f) * CHAN_MAXF + 0.5F) )
+#define UNCLAMPED_FLOAT_TO_CHAN(f) \
+ ( (GLchan) FloatToInt( CLAMP(f, 0.0, 1.0) * CHAN_MAXF + 0.5F) )
+
+#define UNCLAMPED_DOUBLE_TO_CHAN(f) \
+ ( (GLchan) FloatToInt( CLAMP(f, 0.0, 1.0) * CHAN_MAXF + 0.5F) )
+
#endif
-/* $Id: colortab.c,v 1.22 2000/10/28 18:34:48 brianp Exp $ */
+/* $Id: colortab.c,v 1.23 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
return;
}
- _mesa_unpack_ubyte_color_span(ctx, width, table->Format,
- table->Table, /* dest */
- format, type, data,
- &ctx->Unpack, 0);
+ _mesa_unpack_chan_color_span(ctx, width, table->Format,
+ table->Table, /* dest */
+ format, type, data,
+ &ctx->Unpack, 0);
} /* floatTable */
} /* proxy */
if (!table->FloatTable) {
GLchan *dest = (GLchan *) table->Table + start * comps * sizeof(GLchan);
- _mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest,
- format, type, data, &ctx->Unpack, 0);
+ _mesa_unpack_chan_color_span(ctx, count, table->Format, dest,
+ format, type, data, &ctx->Unpack, 0);
}
else {
GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4];
-/* $Id: config.h,v 1.21 2000/10/28 20:41:13 brianp Exp $ */
+/* $Id: config.h,v 1.22 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Bits per color channel (must be 8 at this time!)
*/
#define CHAN_BITS 8
-#if CHAN_BITS == 8
- typedef GLubyte GLchan;
-#define CHAN_MAX 255
-#define CHAN_MAXF 255.0F
-#elif CHAN_BITS == 16
- typedef GLushort GLchan;
-#define CHAN_MAX 65535
-#define CHAN_MAXF 65535.0F
-#elif CHAN_BITS == 32
- typedef GLfloat GLchan;
-#define CHAN_MAX 1.0
-#define CHAN_MAXF 1.0F
-#else
-#error illegal number of color channel bits
-#endif
-
-
-
/*
#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)
-typedef struct __GLcontextRec GLcontext;
-
-extern void
-gl_read_config_file(GLcontext *ctx);
-
-extern void
-gl_register_config_var(const char *name, void (*notify)( const char *, int ));
+/* Some compilers don't like some of Mesa's const usage */
+#ifdef NO_CONST
+# define CONST
+#else
+# define CONST const
+#endif
#endif
-/* $Id: context.h,v 1.19 2000/09/26 20:53:53 brianp Exp $ */
+/* $Id: context.h,v 1.20 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
+extern void
+gl_read_config_file(GLcontext *ctx);
+
+extern void
+gl_register_config_var(const char *name, void (*notify)( const char *, int ));
+
+
#endif
-/* $Id: dd.h,v 1.34 2000/10/28 18:34:48 brianp Exp $ */
+/* $Id: dd.h,v 1.35 2000/10/29 18:12:14 brianp Exp $ */
/*
* Mesa 3-D graphics library
#ifndef DD_INCLUDED
#define DD_INCLUDED
-
-#include "macros.h"
+/* THIS FILE ONLY INCLUDED BY types.h !!!!! */
struct gl_pixelstore_attrib;
-
-
struct vertex_buffer;
struct immediate;
+struct gl_pipeline;
struct gl_pipeline_stage;
-/* THIS FILE ONLY INCLUDED BY types.h !!!!! */
-
/*
* Device Driver (DD) interface
-/* $Id: drawpix.c,v 1.40 2000/10/28 20:41:13 brianp Exp $ */
+/* $Id: drawpix.c,v 1.41 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLenum format, GLenum type, const GLvoid *pixels)
{
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
- GLubyte rgb[MAX_WIDTH][3];
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgb[MAX_WIDTH][3];
+ GLchan rgba[MAX_WIDTH][4];
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glDrawPixels",
GL_FALSE);
* skip "skipRows" rows and skip "skipPixels" pixels/row.
*/
- if (format==GL_RGBA && type==GL_UNSIGNED_BYTE
+ if (format == GL_RGBA && type == CHAN_TYPE
&& ctx->ImageTransferState==0) {
if (ctx->Visual.RGBAflag) {
- GLubyte *src = (GLubyte *) pixels
+ GLchan *src = (GLchan *) pixels
+ (skipRows * rowLength + skipPixels) * 4;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
}
return GL_TRUE;
}
- else if (format==GL_RGB && type==GL_UNSIGNED_BYTE
- && ctx->ImageTransferState==0) {
+ else if (format == GL_RGB && type == CHAN_TYPE
+ && ctx->ImageTransferState == 0) {
if (ctx->Visual.RGBAflag) {
- GLubyte *src = (GLubyte *) pixels
+ GLchan *src = (GLchan *) pixels
+ (skipRows * rowLength + skipPixels) * 3;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
GLint row;
}
return GL_TRUE;
}
- else if (format==GL_LUMINANCE && type==GL_UNSIGNED_BYTE
+ else if (format == GL_LUMINANCE && type == CHAN_TYPE
&& ctx->ImageTransferState==0) {
if (ctx->Visual.RGBAflag) {
- GLubyte *src = (GLubyte *) pixels
+ GLchan *src = (GLchan *) pixels
+ (skipRows * rowLength + skipPixels);
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
}
return GL_TRUE;
}
- else if (format==GL_LUMINANCE_ALPHA && type==GL_UNSIGNED_BYTE
- && ctx->ImageTransferState==0) {
+ else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE
+ && ctx->ImageTransferState == 0) {
if (ctx->Visual.RGBAflag) {
- GLubyte *src = (GLubyte *) pixels
+ GLchan *src = (GLchan *) pixels
+ (skipRows * rowLength + skipPixels)*2;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
- GLubyte *ptr = src;
+ GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
rgba[i][0] = *ptr;
rgba[i][1] = *ptr;
ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
GLint i;
- GLubyte *ptr = src;
+ GLchan *ptr = src;
for (i=0;i<drawWidth;i++) {
rgba[i][0] = *ptr;
rgba[i][1] = *ptr;
GLint row;
ASSERT(drawWidth < MAX_WIDTH);
for (row=0; row<drawHeight; row++) {
- GLubyte *ptr = src;
+ GLchan *ptr = src;
GLint i;
for (i=0;i<drawWidth;i++) {
rgba[i][0] = *ptr;
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
(*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (const GLubyte (*)[4])rgba,
+ (const GLchan (*)[4]) rgba,
NULL);
src += rowLength;
destY++;
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
destY--;
(*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (const GLubyte (*)[4])rgba,
+ (const GLchan (*)[4]) rgba,
NULL);
src += rowLength;
}
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgba[MAX_WIDTH][4];
GLuint ispan[MAX_WIDTH];
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
/* Colors or indexes */
if (ctx->Visual.RGBAflag) {
- GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0F);
- GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0F);
- GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0F);
- GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0F);
+ GLint r = FLOAT_TO_CHAN(ctx->Current.RasterColor[0]);
+ GLint g = FLOAT_TO_CHAN(ctx->Current.RasterColor[1]);
+ GLint b = FLOAT_TO_CHAN(ctx->Current.RasterColor[2]);
+ GLint a = FLOAT_TO_CHAN(ctx->Current.RasterColor[3]);
GLint i;
for (i = 0; i < drawWidth; i++) {
rgba[i][RCOMP] = r;
if (ctx->Visual.RGBAflag) {
if (zoom) {
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
- (const GLubyte (*)[4])rgba, desty);
+ (const GLchan (*)[4]) rgba, desty);
}
else {
gl_write_rgba_span(ctx, width, x, y, zspan, 0, rgba, GL_BITMAP);
* General solution
*/
{
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgba[MAX_WIDTH][4];
GLint row;
if (width > MAX_WIDTH)
width = MAX_WIDTH;
for (row = 0; row < height; row++, y++) {
const GLvoid *source = _mesa_image_address(unpack,
pixels, width, height, format, type, 0, row, 0);
- _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba,
- format, type, source, unpack,
- transferOps);
+ _mesa_unpack_chan_color_span(ctx, width, GL_RGBA, (void*) rgba,
+ format, type, source, unpack,
+ transferOps);
if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) ||
(ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink))
continue;
if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) {
GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH];
- GLubyte primary_rgba[MAX_WIDTH][4];
+ GLchan primary_rgba[MAX_WIDTH][4];
GLuint unit;
/* XXX not sure how multitexture is supposed to work here */
- MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLubyte));
+ MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit].ReallyEnabled) {
- _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba,
+ _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
s, t, r, q);
gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
primary_rgba, rgba);
if (quickDraw) {
(*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
- (CONST GLubyte (*)[]) rgba, NULL);
+ (CONST GLchan (*)[]) rgba, NULL);
}
else if (zoom) {
gl_write_zoomed_rgba_span( ctx, width, x, y, zspan, 0,
- (CONST GLubyte (*)[]) rgba, desty );
+ (CONST GLchan (*)[]) rgba, desty );
}
else {
gl_write_rgba_span( ctx, (GLuint) width, x, y, zspan, 0,
-/* $Id: eval.c,v 1.12 2000/10/28 20:41:14 brianp Exp $ */
+/* $Id: eval.c,v 1.13 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "mem.h"
#include "mmath.h"
#include "types.h"
+#include "vb.h"
#include "vbcull.h"
#include "vbfill.h"
#include "vbxform.h"
-/* $Id: image.c,v 1.44 2000/10/28 20:41:14 brianp Exp $ */
+/* $Id: image.c,v 1.45 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
+/*
+ * Unpack bitmap data. Resulting data will be in most-significant-bit-first
+ * order with row alignment = 1 byte.
+ */
+GLvoid *
+_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
+ const struct gl_pixelstore_attrib *packing )
+{
+ GLint bytes, row, width_in_bytes;
+ GLubyte *buffer, *dst;
+
+ if (!pixels)
+ return NULL;
+
+ /* Alloc dest storage */
+ bytes = ((width + 7) / 8 * height);
+ buffer = (GLubyte *) MALLOC( bytes );
+ if (!buffer)
+ return NULL;
+
+
+ width_in_bytes = CEILING( width, 8 );
+ dst = buffer;
+ for (row = 0; row < height; row++) {
+ GLubyte *src = _mesa_image_address( packing, pixels, width, height,
+ GL_COLOR_INDEX, GL_BITMAP,
+ 0, row, 0 );
+ if (!src) {
+ FREE(buffer);
+ return NULL;
+ }
+
+ if (packing->SkipPixels == 0) {
+ MEMCPY( dst, src, width_in_bytes );
+ if (packing->LsbFirst) {
+ flip_bytes( dst, width_in_bytes );
+ }
+ }
+ else {
+ /* handling SkipPixels is a bit tricky (no pun intended!) */
+ GLint i;
+ if (packing->LsbFirst) {
+ GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 128) {
+ srcMask = 1;
+ s++;
+ }
+ else {
+ srcMask = srcMask << 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ else {
+ GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 1) {
+ srcMask = 128;
+ s++;
+ }
+ else {
+ srcMask = srcMask >> 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ }
+ dst += width_in_bytes;
+ }
+
+ return buffer;
+}
+
/*
- * Pack the given RGBA span into client memory at 'dest' address
- * in the given pixel format and type.
- * Optionally apply the enabled pixel transfer ops.
- * Pack into memory using the given packing params struct.
- * This is used by glReadPixels and glGetTexImage?D()
- * Input: ctx - the context
- * n - number of pixels in the span
- * rgba - the pixels
- * format - dest packing format
- * type - dest packing datatype
- * destination - destination packing address
- * packing - pixel packing parameters
- * transferOps - bitmask of IMAGE_*_BIT operations to apply
+ * Pack bitmap data.
*/
void
-_mesa_pack_rgba_span( GLcontext *ctx,
- GLuint n, CONST GLubyte srcRgba[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr,
- const struct gl_pixelstore_attrib *dstPacking,
- GLuint transferOps)
+_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
+ GLubyte *dest, const struct gl_pixelstore_attrib *packing )
{
- ASSERT(ctx->ImageTransferState != UPDATE_IMAGE_TRANSFER_STATE);
+ GLint row, width_in_bytes;
+ const GLubyte *src;
- /* Test for optimized case first */
- if (transferOps == 0 && dstFormat == GL_RGBA
- && dstType == GL_UNSIGNED_BYTE) {
- /* common simple case */
- MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLubyte));
- }
- else if (transferOps == 0 && dstFormat == GL_RGB
- && dstType == GL_UNSIGNED_BYTE) {
- /* common simple case */
- GLint i;
- GLubyte *dest = (GLubyte *) dstAddr;
- for (i = 0; i < n; i++) {
- dest[0] = srcRgba[i][RCOMP];
- dest[1] = srcRgba[i][GCOMP];
- dest[2] = srcRgba[i][BCOMP];
- dest += 3;
+ if (!source)
+ return;
+
+ width_in_bytes = CEILING( width, 8 );
+ src = source;
+ for (row = 0; row < height; row++) {
+ GLubyte *dst = _mesa_image_address( packing, dest, width, height,
+ GL_COLOR_INDEX, GL_BITMAP,
+ 0, row, 0 );
+ if (!dst)
+ return;
+
+ if (packing->SkipPixels == 0) {
+ MEMCPY( dst, src, width_in_bytes );
+ if (packing->LsbFirst) {
+ flip_bytes( dst, width_in_bytes );
+ }
}
- }
- else {
- /* general solution */
- GLfloat rgba[MAX_WIDTH][4];
- const GLfloat rscale = 1.0F / 255.0F;
- const GLfloat gscale = 1.0F / 255.0F;
- const GLfloat bscale = 1.0F / 255.0F;
- const GLfloat ascale = 1.0F / 255.0F;
- GLuint i;
- assert(n <= MAX_WIDTH);
- /* convert color components to floating point */
- for (i=0;i<n;i++) {
- rgba[i][RCOMP] = srcRgba[i][RCOMP] * rscale;
- rgba[i][GCOMP] = srcRgba[i][GCOMP] * gscale;
- rgba[i][BCOMP] = srcRgba[i][BCOMP] * bscale;
- rgba[i][ACOMP] = srcRgba[i][ACOMP] * ascale;
+ else {
+ /* handling SkipPixels is a bit tricky (no pun intended!) */
+ GLint i;
+ if (packing->LsbFirst) {
+ GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 128) {
+ srcMask = 1;
+ s++;
+ }
+ else {
+ srcMask = srcMask << 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
+ else {
+ GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
+ GLubyte dstMask = 128;
+ const GLubyte *s = src;
+ GLubyte *d = dst;
+ *d = 0;
+ for (i = 0; i < width; i++) {
+ if (*s & srcMask) {
+ *d |= dstMask;
+ }
+ if (srcMask == 1) {
+ srcMask = 128;
+ s++;
+ }
+ else {
+ srcMask = srcMask >> 1;
+ }
+ if (dstMask == 1) {
+ dstMask = 128;
+ d++;
+ *d = 0;
+ }
+ else {
+ dstMask = dstMask >> 1;
+ }
+ }
+ }
}
- _mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba,
- dstFormat, dstType, dstAddr,
- dstPacking, transferOps);
+ src += width_in_bytes;
}
}
+
void
_mesa_pack_float_rgba_span( GLcontext *ctx,
GLuint n, CONST GLfloat rgbaIn[][4],
+/*
+ * Pack the given RGBA span into client memory at 'dest' address
+ * in the given pixel format and type.
+ * Optionally apply the enabled pixel transfer ops.
+ * Pack into memory using the given packing params struct.
+ * This is used by glReadPixels and glGetTexImage?D()
+ * Input: ctx - the context
+ * n - number of pixels in the span
+ * rgba - the pixels
+ * format - dest packing format
+ * type - dest packing datatype
+ * destination - destination packing address
+ * packing - pixel packing parameters
+ * transferOps - bitmask of IMAGE_*_BIT operations to apply
+ */
+void
+_mesa_pack_rgba_span( GLcontext *ctx,
+ GLuint n, CONST GLchan srcRgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr,
+ const struct gl_pixelstore_attrib *dstPacking,
+ GLuint transferOps)
+{
+ ASSERT(ctx->ImageTransferState != UPDATE_IMAGE_TRANSFER_STATE);
+
+ /* Test for optimized case first */
+ if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) {
+ /* common simple case */
+ MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan));
+ }
+ else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) {
+ /* common simple case */
+ GLint i;
+ GLchan *dest = (GLchan *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dest[0] = srcRgba[i][RCOMP];
+ dest[1] = srcRgba[i][GCOMP];
+ dest[2] = srcRgba[i][BCOMP];
+ dest += 3;
+ }
+ }
+ else {
+ /* general solution */
+ GLfloat rgba[MAX_WIDTH][4];
+ GLuint i;
+ assert(n <= MAX_WIDTH);
+ /* convert color components to floating point */
+ for (i=0;i<n;i++) {
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]);
+ }
+ _mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba,
+ dstFormat, dstType, dstAddr,
+ dstPacking, transferOps);
+ }
+}
+
+
#define SWAP2BYTE(VALUE) \
{ \
GLubyte *bytes = (GLubyte *) &(VALUE); \
* XXX perhaps expand this to process whole images someday.
*/
void
-_mesa_unpack_ubyte_color_span( GLcontext *ctx,
- GLuint n, GLenum dstFormat, GLubyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLuint transferOps )
+_mesa_unpack_chan_color_span( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLchan dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps )
{
ASSERT(dstFormat == GL_ALPHA ||
dstFormat == GL_LUMINANCE ||
assert(ctx->Visual.RGBAflag);
/* Try simple cases first */
- if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE) {
+ if (transferOps == 0 && srcType == CHAN_TYPE) {
if (dstFormat == GL_RGBA) {
if (srcFormat == GL_RGBA) {
- MEMCPY( dest, source, n * 4 * sizeof(GLubyte) );
+ MEMCPY( dest, source, n * 4 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGB) {
GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLubyte *dst = dest;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
for (i = 0; i < n; i++) {
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
- dst[3] = 255;
+ dst[3] = CHAN_MAX;
src += 3;
dst += 4;
}
}
else if (dstFormat == GL_RGB) {
if (srcFormat == GL_RGB) {
- MEMCPY( dest, source, n * 3 * sizeof(GLubyte) );
+ MEMCPY( dest, source, n * 3 * sizeof(GLchan) );
return;
}
else if (srcFormat == GL_RGBA) {
GLuint i;
- const GLubyte *src = (const GLubyte *) source;
- GLubyte *dst = dest;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
for (i = 0; i < n; i++) {
dst[0] = src[0];
dst[1] = src[1];
else if (dstFormat == srcFormat) {
GLint comps = _mesa_components_in_format(srcFormat);
assert(comps > 0);
- MEMCPY( dest, source, n * comps * sizeof(GLubyte) );
+ MEMCPY( dest, source, n * comps * sizeof(GLchan) );
return;
}
}
}
if (dstFormat == GL_COLOR_INDEX) {
- /* convert to GLubyte and return */
+ /* convert to GLchan and return */
GLuint i;
for (i = 0; i < n; i++) {
- dest[i] = (GLubyte) (indexes[i] & 0xff);
+ dest[i] = (GLchan) (indexes[i] & 0xff);
}
return;
}
dstLuminanceIndex = dstIntensityIndex = -1;
break;
default:
- gl_problem(ctx, "bad dstFormat in _mesa_unpack_ubyte_span()");
+ gl_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()");
return;
}
- /* Now return the GLubyte data in the requested dstFormat */
+ /* Now return the GLchan data in the requested dstFormat */
if (dstRedIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
for (i = 0; i < n; i++) {
- dst[dstRedIndex] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
+ dst[dstRedIndex] = FLOAT_TO_CHAN(rgba[i][RCOMP]);
dst += dstComponents;
}
}
if (dstGreenIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
for (i = 0; i < n; i++) {
- dst[dstGreenIndex] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
+ dst[dstGreenIndex] = FLOAT_TO_CHAN(rgba[i][GCOMP]);
dst += dstComponents;
}
}
if (dstBlueIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
for (i = 0; i < n; i++) {
- dst[dstBlueIndex] = FLOAT_TO_UBYTE(rgba[i][BCOMP]);
+ dst[dstBlueIndex] = FLOAT_TO_CHAN(rgba[i][BCOMP]);
dst += dstComponents;
}
}
if (dstAlphaIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
for (i = 0; i < n; i++) {
- dst[dstAlphaIndex] = FLOAT_TO_UBYTE(rgba[i][ACOMP]);
+ dst[dstAlphaIndex] = FLOAT_TO_CHAN(rgba[i][ACOMP]);
dst += dstComponents;
}
}
if (dstIntensityIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
assert(dstIntensityIndex == 0);
assert(dstComponents == 1);
for (i = 0; i < n; i++) {
/* Intensity comes from red channel */
- dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
+ dst[i] = FLOAT_TO_CHAN(rgba[i][RCOMP]);
}
}
if (dstLuminanceIndex >= 0) {
- GLubyte *dst = dest;
+ GLchan *dst = dest;
GLuint i;
assert(dstLuminanceIndex == 0);
for (i = 0; i < n; i++) {
/* Luminance comes from red channel */
- dst[0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
+ dst[0] = FLOAT_TO_CHAN(rgba[i][RCOMP]);
dst += dstComponents;
}
}
}
if (dstFormat == GL_COLOR_INDEX) {
- /* convert to GLubyte and return */
+ /* convert to GLchan and return */
GLuint i;
for (i = 0; i < n; i++) {
- dest[i] = (GLubyte) (indexes[i] & 0xff);
+ dest[i] = (GLchan) (indexes[i] & 0xff);
}
return;
}
return destBuffer;
}
}
-
-
-/*
- * Unpack bitmap data. Resulting data will be in most-significant-bit-first
- * order with row alignment = 1 byte.
- */
-GLvoid *
-_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
- const struct gl_pixelstore_attrib *packing )
-{
- GLint bytes, row, width_in_bytes;
- GLubyte *buffer, *dst;
-
- if (!pixels)
- return NULL;
-
- /* Alloc dest storage */
- bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) MALLOC( bytes );
- if (!buffer)
- return NULL;
-
-
- width_in_bytes = CEILING( width, 8 );
- dst = buffer;
- for (row = 0; row < height; row++) {
- GLubyte *src = _mesa_image_address( packing, pixels, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- 0, row, 0 );
- if (!src) {
- FREE(buffer);
- return NULL;
- }
-
- if (packing->SkipPixels == 0) {
- MEMCPY( dst, src, width_in_bytes );
- if (packing->LsbFirst) {
- flip_bytes( dst, width_in_bytes );
- }
- }
- else {
- /* handling SkipPixels is a bit tricky (no pun intended!) */
- GLint i;
- if (packing->LsbFirst) {
- GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 128) {
- srcMask = 1;
- s++;
- }
- else {
- srcMask = srcMask << 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- else {
- GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- }
- dst += width_in_bytes;
- }
-
- return buffer;
-}
-
-
-/*
- * Pack bitmap data.
- */
-void
-_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
- GLubyte *dest, const struct gl_pixelstore_attrib *packing )
-{
- GLint row, width_in_bytes;
- const GLubyte *src;
-
- if (!source)
- return;
-
- width_in_bytes = CEILING( width, 8 );
- src = source;
- for (row = 0; row < height; row++) {
- GLubyte *dst = _mesa_image_address( packing, dest, width, height,
- GL_COLOR_INDEX, GL_BITMAP,
- 0, row, 0 );
- if (!dst)
- return;
-
- if (packing->SkipPixels == 0) {
- MEMCPY( dst, src, width_in_bytes );
- if (packing->LsbFirst) {
- flip_bytes( dst, width_in_bytes );
- }
- }
- else {
- /* handling SkipPixels is a bit tricky (no pun intended!) */
- GLint i;
- if (packing->LsbFirst) {
- GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 128) {
- srcMask = 1;
- s++;
- }
- else {
- srcMask = srcMask << 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- else {
- GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
- GLubyte dstMask = 128;
- const GLubyte *s = src;
- GLubyte *d = dst;
- *d = 0;
- for (i = 0; i < width; i++) {
- if (*s & srcMask) {
- *d |= dstMask;
- }
- if (srcMask == 1) {
- srcMask = 128;
- s++;
- }
- else {
- srcMask = srcMask >> 1;
- }
- if (dstMask == 1) {
- dstMask = 128;
- d++;
- *d = 0;
- }
- else {
- dstMask = dstMask >> 1;
- }
- }
- }
- }
- src += width_in_bytes;
- }
-}
-/* $Id: image.h,v 1.12 2000/08/31 15:24:07 brianp Exp $ */
+/* $Id: image.h,v 1.13 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
const struct gl_pixelstore_attrib *packing );
+extern GLvoid *
+_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
+ const struct gl_pixelstore_attrib *packing );
+
+extern void
+_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
+ GLubyte *dest, const struct gl_pixelstore_attrib *packing );
+
+
extern void
_mesa_pack_float_rgba_span( GLcontext *ctx,
GLuint n, CONST GLfloat rgba[][4],
extern void
_mesa_pack_rgba_span( GLcontext *ctx,
- GLuint n, CONST GLubyte rgba[][4],
+ GLuint n, CONST GLchan rgba[][4],
GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
const struct gl_pixelstore_attrib *dstPacking,
GLuint transferOps );
extern void
-_mesa_unpack_ubyte_color_span( GLcontext *ctx,
- GLuint n, GLenum dstFormat, GLubyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLuint transferOps );
+_mesa_unpack_chan_color_span( GLcontext *ctx,
+ GLuint n, GLenum dstFormat, GLchan dest[],
+ GLenum srcFormat, GLenum srcType,
+ const GLvoid *source,
+ const struct gl_pixelstore_attrib *srcPacking,
+ GLuint transferOps );
extern void
const struct gl_pixelstore_attrib *unpack );
-extern GLvoid *
-_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
- const struct gl_pixelstore_attrib *packing );
-
-extern void
-_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
- GLubyte *dest, const struct gl_pixelstore_attrib *packing );
-
-
#endif
-/* $Id: matrix.h,v 1.7 2000/09/17 21:56:07 brianp Exp $ */
+/* $Id: matrix.h,v 1.8 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "types.h"
-#include "config.h"
-
-
-/* Give symbolic names to some of the entries in the matrix to help
- * out with the rework of the viewport_map as a matrix transform.
- */
-#define MAT_SX 0
-#define MAT_SY 5
-#define MAT_SZ 10
-#define MAT_TX 12
-#define MAT_TY 13
-#define MAT_TZ 14
-
-
-/*
- * Different kinds of 4x4 transformation matrices:
- */
-#define MATRIX_GENERAL 0 /* general 4x4 matrix */
-#define MATRIX_IDENTITY 1 /* identity matrix */
-#define MATRIX_3D_NO_ROT 2 /* ortho projection and others... */
-#define MATRIX_PERSPECTIVE 3 /* perspective projection matrix */
-#define MATRIX_2D 4 /* 2-D transformation */
-#define MATRIX_2D_NO_ROT 5 /* 2-D scale & translate only */
-#define MATRIX_3D 6 /* 3-D transformation */
-
-#define MAT_FLAG_IDENTITY 0
-#define MAT_FLAG_GENERAL 0x1
-#define MAT_FLAG_ROTATION 0x2
-#define MAT_FLAG_TRANSLATION 0x4
-#define MAT_FLAG_UNIFORM_SCALE 0x8
-#define MAT_FLAG_GENERAL_SCALE 0x10
-#define MAT_FLAG_GENERAL_3D 0x20
-#define MAT_FLAG_PERSPECTIVE 0x40
-#define MAT_DIRTY_TYPE 0x80
-#define MAT_DIRTY_FLAGS 0x100
-#define MAT_DIRTY_INVERSE 0x200
-#define MAT_DIRTY_DEPENDENTS 0x400
-
-#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \
- MAT_FLAG_TRANSLATION | \
- MAT_FLAG_UNIFORM_SCALE)
-
-#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \
- MAT_FLAG_TRANSLATION)
-
-#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \
- MAT_FLAG_TRANSLATION | \
- MAT_FLAG_UNIFORM_SCALE | \
- MAT_FLAG_GENERAL_SCALE | \
- MAT_FLAG_GENERAL_3D)
-
-#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \
- MAT_FLAG_ROTATION | \
- MAT_FLAG_TRANSLATION | \
- MAT_FLAG_UNIFORM_SCALE | \
- MAT_FLAG_GENERAL_SCALE | \
- MAT_FLAG_GENERAL_3D | \
- MAT_FLAG_PERSPECTIVE)
-
-#define MAT_DIRTY_ALL_OVER (MAT_DIRTY_TYPE | \
- MAT_DIRTY_DEPENDENTS | \
- MAT_DIRTY_FLAGS | \
- MAT_DIRTY_INVERSE)
-
-#define TEST_MAT_FLAGS(mat, a) ((MAT_FLAGS_GEOMETRY&(~(a))&((mat)->flags))==0)
-
-
-
-
-typedef struct {
- GLfloat *m; /* 16-byte aligned */
- GLfloat *inv; /* optional, 16-byte aligned */
- GLuint flags;
- GLuint type; /* one of the MATRIX_* values */
-} GLmatrix;
#ifdef VMS
-/* $Id: pixel.c,v 1.15 2000/10/28 20:41:14 brianp Exp $ */
+/* $Id: pixel.c,v 1.16 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* replace RGBA with I */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F);
- GLfloat c = lut[j] * (1.0F / 255.0F);
+ GLfloat c = CHAN_TO_FLOAT(lut[j]);
rgba[i][RCOMP] = rgba[i][GCOMP] =
rgba[i][BCOMP] = rgba[i][ACOMP] = c;
}
/* replace RGB with L */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F);
- GLfloat c = lut[j] * (1.0F / 255.0F);
+ GLfloat c = CHAN_TO_FLOAT(lut[j]);
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c;
}
}
/* replace A with A */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F);
- rgba[i][ACOMP] = lut[j] * (1.0F / 255.0F);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[j]);
}
}
else {
/* replace RGBA with LLLA */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F);
GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F);
- GLfloat luminance = lut[jL * 2 + 0] * (1.0F / 255.0F);
- GLfloat alpha = lut[jA * 2 + 1] * (1.0F / 255.0F);
+ GLfloat luminance = CHAN_TO_FLOAT(lut[jL * 2 + 0]);
+ GLfloat alpha = CHAN_TO_FLOAT(lut[jA * 2 + 1]);
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance;
rgba[i][ACOMP] = alpha;;
}
/* replace RGB with RGB */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F);
GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F);
GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F);
- rgba[i][RCOMP] = lut[jR * 3 + 0] * (1.0F / 255.0F);
- rgba[i][GCOMP] = lut[jG * 3 + 1] * (1.0F / 255.0F);
- rgba[i][BCOMP] = lut[jB * 3 + 2] * (1.0F / 255.0F);
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 3 + 0]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 3 + 1]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 3 + 2]);
}
}
else {
/* replace RGBA with RGBA */
if (!table->FloatTable) {
const GLfloat scale = (GLfloat) (table->Size - 1);
- const GLubyte *lut = (const GLubyte *) table->Table;
+ const GLchan *lut = (const GLchan *) table->Table;
GLuint i;
for (i = 0; i < n; i++) {
GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F);
GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F);
GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F);
GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F);
- rgba[i][RCOMP] = lut[jR * 4 + 0] * (1.0F / 255.0F);
- rgba[i][GCOMP] = lut[jG * 4 + 1] * (1.0F / 255.0F);
- rgba[i][BCOMP] = lut[jB * 4 + 2] * (1.0F / 255.0F);
- rgba[i][ACOMP] = lut[jA * 4 + 3] * (1.0F / 255.0F);
+ rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 4 + 0]);
+ rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 4 + 1]);
+ rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 4 + 2]);
+ rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[jA * 4 + 3]);
}
}
else {
* Map color indexes to rgba values.
*/
void
-_mesa_map_ci_to_rgba_ubyte( const GLcontext *ctx, GLuint n,
- const GLuint index[], GLubyte rgba[][4] )
+_mesa_map_ci_to_rgba_chan( const GLcontext *ctx, GLuint n,
+ const GLuint index[], GLchan rgba[][4] )
{
+#if CHAN_BITS == 8
GLuint rmask = ctx->Pixel.MapItoRsize - 1;
GLuint gmask = ctx->Pixel.MapItoGsize - 1;
GLuint bmask = ctx->Pixel.MapItoBsize - 1;
rgba[i][BCOMP] = bMap[index[i] & bmask];
rgba[i][ACOMP] = aMap[index[i] & amask];
}
+#else
+ GLuint rmask = ctx->Pixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLfloat *rMap = ctx->Pixel.MapItoR;
+ const GLfloat *gMap = ctx->Pixel.MapItoG;
+ const GLfloat *bMap = ctx->Pixel.MapItoB;
+ const GLfloat *aMap = ctx->Pixel.MapItoA;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ rgba[i][RCOMP] = FLOAT_TO_CHAN(rMap[index[i] & rmask]);
+ rgba[i][GCOMP] = FLOAT_TO_CHAN(gMap[index[i] & gmask]);
+ rgba[i][BCOMP] = FLOAT_TO_CHAN(bMap[index[i] & bmask]);
+ rgba[i][ACOMP] = FLOAT_TO_CHAN(aMap[index[i] & amask]);
+ }
+#endif
}
*/
void
_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[],
- GLubyte rgba[][4] )
+ GLchan rgba[][4] )
{
+#if CHAN_BITS == 8
GLuint rmask = ctx->Pixel.MapItoRsize - 1;
GLuint gmask = ctx->Pixel.MapItoGsize - 1;
GLuint bmask = ctx->Pixel.MapItoBsize - 1;
rgba[i][BCOMP] = bMap[index[i] & bmask];
rgba[i][ACOMP] = aMap[index[i] & amask];
}
+#else
+ GLuint rmask = ctx->Pixel.MapItoRsize - 1;
+ GLuint gmask = ctx->Pixel.MapItoGsize - 1;
+ GLuint bmask = ctx->Pixel.MapItoBsize - 1;
+ GLuint amask = ctx->Pixel.MapItoAsize - 1;
+ const GLfloat *rMap = ctx->Pixel.MapItoR8;
+ const GLfloat *gMap = ctx->Pixel.MapItoG8;
+ const GLfloat *bMap = ctx->Pixel.MapItoB8;
+ const GLfloat *aMap = ctx->Pixel.MapItoA8;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ rgba[i][RCOMP] = FLOAT_TO_CHAN(rMap[index[i] & rmask]);
+ rgba[i][GCOMP] = FLOAT_TO_CHAN(gMap[index[i] & gmask]);
+ rgba[i][BCOMP] = FLOAT_TO_CHAN(bMap[index[i] & bmask]);
+ rgba[i][ACOMP] = FLOAT_TO_CHAN(aMap[index[i] & amask]);
+ }
+#endif
}
-/* $Id: pixel.h,v 1.5 2000/04/12 18:54:48 brianp Exp $ */
+/* $Id: pixel.h,v 1.6 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
extern void
-_mesa_map_ci_to_rgba_ubyte(const GLcontext *ctx,
- GLuint n, const GLuint index[],
- GLubyte rgba[][4]);
+_mesa_map_ci_to_rgba_chan(const GLcontext *ctx,
+ GLuint n, const GLuint index[],
+ GLchan rgba[][4]);
extern void
extern void
_mesa_map_ci8_to_rgba(const GLcontext *ctx,
GLuint n, const GLubyte index[],
- GLubyte rgba[][4]);
+ GLchan rgba[][4]);
extern void
-/* $Id: state.c,v 1.35 2000/10/27 18:31:23 brianp Exp $ */
+/* $Id: state.c,v 1.36 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
ctx->rescale_factor = 1.0F;
-
if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE |
MAT_FLAG_GENERAL_SCALE |
MAT_FLAG_GENERAL_3D |
- MAT_FLAG_GENERAL) )
-
- {
- GLfloat *m = ctx->ModelView.inv;
- GLfloat f = m[2]*m[2] + m[6]*m[6] + m[10]*m[10];
- if (f > 1e-12 && (f-1)*(f-1) > 1e-12)
- ctx->rescale_factor = 1.0/GL_SQRT(f);
+ MAT_FLAG_GENERAL) ) {
+ const GLfloat *m = ctx->ModelView.inv;
+ const GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
+ if (f > 1e-12 && (f - 1.0) * (f - 1.0) > 1e-12)
+ ctx->rescale_factor = 1.0 / GL_SQRT(f);
}
}
-/* $Id: teximage.c,v 1.53 2000/10/28 18:34:48 brianp Exp $ */
+/* $Id: teximage.c,v 1.54 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
* NOTES:
*
- * Mesa's native texture datatype is GLubyte. Native formats are
+ * Mesa's native texture datatype is GLchan. Native formats are
* GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, GL_RGBA,
* and GL_COLOR_INDEX.
* Device drivers are free to implement any internal format they want.
static void PrintTexture(const struct gl_texture_image *img)
{
int i, j, c;
- GLubyte *data = img->Data;
+ GLchan *data = img->Data;
if (!data) {
printf("No texture data\n");
* care of all image transfer operations here, including convolution.
* Input:
* dstXoffset, dstYoffset, dstZoffset - offsets in pixels
- * dstRowStride, dstImageStride - strides in bytes
+ * dstRowStride, dstImageStride - strides in GLchan's
*/
static void
fill_texture_image( GLcontext *ctx, GLuint dimensions,
- GLenum texFormat, GLubyte *texAddr,
+ GLenum texFormat, GLchan *texAddr,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
GLint dstRowStride, GLint dstImageStride,
/* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE_ALPHA, etc. texture formats. Use memcpy().
*/
- const GLubyte *src = (const GLubyte *) _mesa_image_address(
+ const GLchan *src = (const GLchan *) _mesa_image_address(
srcPacking, srcAddr, srcWidth, srcHeight,
srcFormat, srcType, 0, 0, 0);
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
- const GLint widthInBytes = srcWidth * texComponents;
- GLubyte *dst = texAddr + dstYoffset * dstRowStride
- + dstXoffset * texComponents * sizeof(GLubyte);
+ const GLint widthInBytes = srcWidth * texComponents * sizeof(GLchan);
+ GLchan *dst = texAddr + dstYoffset * dstRowStride
+ + dstXoffset * texComponents;
if (srcRowStride == widthInBytes && dstRowStride == widthInBytes) {
MEMCPY(dst, src, srcHeight * widthInBytes);
}
}
else if (srcFormat == GL_RGBA && texFormat == GL_RGB) {
/* commonly used by Quake */
- const GLubyte *src = (const GLubyte *) _mesa_image_address(
+ const GLchan *src = (const GLchan *) _mesa_image_address(
srcPacking, srcAddr, srcWidth, srcHeight,
srcFormat, srcType, 0, 0, 0);
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType);
- GLubyte *dst = texAddr + dstYoffset * dstRowStride
- + dstXoffset * texComponents * sizeof(GLubyte);
+ GLchan *dst = texAddr + dstYoffset * dstRowStride
+ + dstXoffset * texComponents;
GLint i, j;
for (i = 0; i < srcHeight; i++) {
- const GLubyte *s = src;
- GLubyte *d = dst;
+ const GLchan *s = src;
+ GLchan *d = dst;
for (j = 0; j < srcWidth; j++) {
*d++ = *s++; /*red*/
*d++ = *s++; /*green*/
/* color index texture */
const GLenum texType = GL_UNSIGNED_BYTE;
GLint img, row;
- GLubyte *dest = texAddr + dstZoffset * dstImageStride
+ GLchan *dest = texAddr + dstZoffset * dstImageStride
+ dstYoffset * dstRowStride
- + dstXoffset * texComponents * sizeof(GLubyte);
+ + dstXoffset * texComponents;
for (img = 0; img < srcDepth; img++) {
- GLubyte *destRow = dest;
+ GLchan *destRow = dest;
for (row = 0; row < srcHeight; row++) {
const GLvoid *src = _mesa_image_address(srcPacking,
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
for (img = 0; img < srcDepth; img++) {
const GLfloat *srcf;
GLfloat *dstf = tmpImage;
- GLubyte *dest;
+ GLchan *dest;
/* unpack and do transfer ops up to convolution */
for (row = 0; row < srcHeight; row++) {
* no convolution
*/
GLint img, row;
- GLubyte *dest = texAddr + dstZoffset * dstImageStride
+ GLchan *dest = texAddr + dstZoffset * dstImageStride
+ dstYoffset * dstRowStride
- + dstXoffset * texComponents * sizeof(GLubyte);
+ + dstXoffset * texComponents;
for (img = 0; img < srcDepth; img++) {
- GLubyte *destRow = dest;
+ GLchan *destRow = dest;
for (row = 0; row < srcHeight; row++) {
const GLvoid *srcRow = _mesa_image_address(srcPacking,
srcAddr, srcWidth, srcHeight,
srcFormat, srcType, img, row, 0);
- _mesa_unpack_ubyte_color_span(ctx, srcWidth, texFormat, destRow,
+ _mesa_unpack_chan_color_span(ctx, srcWidth, texFormat, destRow,
srcFormat, srcType, srcRow, srcPacking,
ctx->ImageTransferState);
destRow += dstRowStride;
* X86 optimized code.
*/
#ifdef USE_X86_ASM
-# define EXTRA_BYTE 1
+# define EXTRA_BYTE sizeof(GLchan)
#else
# define EXTRA_BYTE 0
#endif
&convWidth, &convHeight);
}
- texImage->Data = (GLubyte *) MALLOC(convWidth * convHeight * depth
- * components + EXTRA_BYTE);
+ texImage->Data = (GLchan *) MALLOC(convWidth * convHeight * depth
+ * components * sizeof(GLchan) + EXTRA_BYTE);
if (!texImage->Data)
return; /* out of memory */
fill_texture_image(ctx, dimensions, texImage->Format, texImage->Data,
width, height, depth, 0, 0, 0,
- convWidth * components * sizeof(GLubyte),
- convWidth * convHeight * components * sizeof(GLubyte),
+ convWidth * components * sizeof(GLchan),
+ convWidth * convHeight * components * sizeof(GLchan),
srcFormat, srcType, pixels, srcPacking);
}
components = components_in_intformat(texImage->IntFormat);
numPixels = texImage->Width * texImage->Height * texImage->Depth;
- texImage->Data = (GLubyte *) MALLOC( numPixels * components + EXTRA_BYTE );
+ texImage->Data = (GLchan *) MALLOC( numPixels * components * sizeof(GLchan)
+ + EXTRA_BYTE );
/*
* Let's see if anyone finds this. If glTexImage2D() is called with
" "
};
- GLubyte *imgPtr = texImage->Data;
+ GLchan *imgPtr = texImage->Data;
GLint i, j, k;
for (i = 0; i < texImage->Height; i++) {
GLint srcRow = 7 - i % 8;
GLint srcCol = j % 32;
GLint texel = (message[srcRow][srcCol]=='X') ? CHAN_MAX : 70;
for (k=0;k<components;k++) {
- *imgPtr++ = (GLubyte) texel;
+ *imgPtr++ = (GLchan) texel;
}
}
}
if (!texImage->Data) {
/* Allocate memory for the texture image data */
- texImage->Data = (GLubyte *) MALLOC(numPixels * destComponents + EXTRA_BYTE);
+ texImage->Data = (GLchan *) MALLOC(numPixels * destComponents
+ * sizeof(GLchan) + EXTRA_BYTE);
}
if (imgFormat == texImage->Format && imgType == GL_UNSIGNED_BYTE) {
const GLint srcBytesPerRow = width * srcBytesPerTexel;
const GLenum dstType = GL_UNSIGNED_BYTE;
const GLenum dstFormat = texImage->Format;
- const GLubyte *srcPtr = (const GLubyte *) image;
- GLubyte *destPtr = texImage->Data;
+ const GLchan *srcPtr = (const GLchan *) image;
+ GLchan *destPtr = texImage->Data;
if (texImage->Format == GL_COLOR_INDEX) {
/* color index texture */
GLint img, row;
for (img = 0; img < depth; img++) {
for (row = 0; row < height; row++) {
- _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, destPtr,
+ _mesa_unpack_chan_color_span(ctx, width, dstFormat, destPtr,
imgFormat, imgType, srcPtr, &_mesa_native_packing, GL_FALSE);
destPtr += destBytesPerRow;
srcPtr += srcBytesPerRow;
/* convert to GL_RGBA */
for (row = 0; row < height; row++) {
- const GLubyte *src = texImage->Data
+ const GLchan *src = texImage->Data
+ (img * height + row ) * width * comps;
GLfloat *dst = tmpImage + row * width * 4;
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst,
assert(dest);
if (texImage->Format == GL_RGBA) {
/* simple case */
- const GLubyte *src = texImage->Data
+ const GLchan *src = texImage->Data
+ (img * height + row ) * width * 4;
- _mesa_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src,
+ _mesa_pack_rgba_span( ctx, width, (CONST GLchan (*)[4]) src,
format, type, dest, &ctx->Pack,
ctx->ImageTransferState );
}
else {
/* general case: convert row to RGBA format */
- GLubyte rgba[MAX_WIDTH][4];
+ GLchan rgba[MAX_WIDTH][4];
GLint i;
- const GLubyte *src;
+ const GLchan *src;
switch (texImage->Format) {
case GL_ALPHA:
- src = texImage->Data + row * width * sizeof(GLubyte);
+ src = texImage->Data + row * width;
for (i = 0; i < width; i++) {
rgba[i][RCOMP] = CHAN_MAX;
rgba[i][GCOMP] = CHAN_MAX;
}
break;
case GL_LUMINANCE:
- src = texImage->Data + row * width * sizeof(GLubyte);
+ src = texImage->Data + row * width;
for (i = 0; i < width; i++) {
rgba[i][RCOMP] = src[i];
rgba[i][GCOMP] = src[i];
}
break;
case GL_LUMINANCE_ALPHA:
- src = texImage->Data + row * 2 * width * sizeof(GLubyte);
+ src = texImage->Data + row * 2 * width;
for (i = 0; i < width; i++) {
rgba[i][RCOMP] = src[i*2+0];
rgba[i][GCOMP] = src[i*2+0];
}
break;
case GL_INTENSITY:
- src = texImage->Data + row * width * sizeof(GLubyte);
+ src = texImage->Data + row * width;
for (i = 0; i < width; i++) {
rgba[i][RCOMP] = src[i];
rgba[i][GCOMP] = src[i];
}
break;
case GL_RGB:
- src = texImage->Data + row * 3 * width * sizeof(GLubyte);
+ src = texImage->Data + row * 3 * width;
for (i = 0; i < width; i++) {
rgba[i][RCOMP] = src[i*3+0];
rgba[i][GCOMP] = src[i*3+1];
default:
gl_problem( ctx, "bad format in gl_GetTexImage" );
}
- _mesa_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba,
+ _mesa_pack_rgba_span( ctx, width, (const GLchan (*)[4])rgba,
format, type, dest, &ctx->Pack,
ctx->ImageTransferState );
} /* format */
if (!success) {
/* XXX if Driver.TexSubImage2D, unpack image and try again? */
const GLint texComps = components_in_intformat(texImage->Format);
- const GLint texRowStride = texImage->Width * texComps * sizeof(GLubyte);
+ const GLint texRowStride = texImage->Width * texComps;
GLboolean retain = GL_TRUE;
if (!texImage->Data) {
if (!success) {
/* XXX if Driver.TexSubImage3D, unpack image and try again? */
const GLint texComps = components_in_intformat(texImage->Format);
- const GLint texRowStride = texImage->Width * texComps * sizeof(GLubyte);
+ const GLint texRowStride = texImage->Width * texComps;
const GLint texImgStride = texRowStride * texImage->Height;
GLboolean retain = GL_TRUE;
* Input: ctx - the context
* x, y - lower left corner
* width, height - size of region to read
- * Return: pointer to block of GL_RGBA, GLubyte data.
+ * Return: pointer to block of GL_RGBA, GLchan data.
*/
-static GLubyte *
+static GLchan *
read_color_image( GLcontext *ctx, GLint x, GLint y,
GLsizei width, GLsizei height )
{
GLint stride, i;
- GLubyte *image, *dst;
+ GLchan *image, *dst;
- image = (GLubyte *) MALLOC(width * height * 4 * sizeof(GLubyte));
+ image = (GLchan *) MALLOC(width * height * 4 * sizeof(GLchan));
if (!image)
return NULL;
ctx->Pixel.DriverReadBuffer );
dst = image;
- stride = width * 4 * sizeof(GLubyte);
+ stride = width * 4;
for (i = 0; i < height; i++) {
gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y + i,
- (GLubyte (*)[4]) dst );
+ (GLchan (*)[4]) dst );
dst += stride;
}
struct gl_pixelstore_attrib unpackSave;
/* get image from framebuffer */
- GLubyte *image = read_color_image( ctx, x, y, width, 1 );
+ GLchan *image = read_color_image( ctx, x, y, width, 1 );
if (!image) {
gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D" );
return;
struct gl_pixelstore_attrib unpackSave;
/* get image from framebuffer */
- GLubyte *image = read_color_image( ctx, x, y, width, height );
+ GLchan *image = read_color_image( ctx, x, y, width, height );
if (!image) {
gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D" );
return;
struct gl_texture_unit *texUnit;
struct gl_texture_image *teximage;
struct gl_pixelstore_attrib unpackSave;
- GLubyte *image;
+ GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
teximage = texUnit->CurrentD[1]->Image[level];
struct gl_texture_unit *texUnit;
struct gl_texture_image *teximage;
struct gl_pixelstore_attrib unpackSave;
- GLubyte *image;
+ GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
teximage = texUnit->CurrentD[2]->Image[level];
struct gl_texture_unit *texUnit;
struct gl_texture_image *teximage;
struct gl_pixelstore_attrib unpackSave;
- GLubyte *image;
+ GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
teximage = texUnit->CurrentD[3]->Image[level];
-/* $Id: texutil.c,v 1.7 2000/09/13 22:07:20 brianp Exp $ */
+/* $Id: texutil.c,v 1.8 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.4
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
GLubyte r = src[col3 + 0];
GLubyte g = src[col3 + 1];
GLubyte b = src[col3 + 2];
- GLubyte a = 255;
+ GLubyte a = CHAN_MAX;
dst[col] = (a << 24) | (r << 16) | (g << 8) | b;
}
src += srcStride;
GLubyte r = src[col3 + 0];
GLubyte g = src[col3 + 1];
GLubyte b = src[col3 + 2];
- GLubyte a = 255;
+ GLubyte a = CHAN_MAX;
dst[col] = (a << 24) | (r << 16) | (g << 8) | b;
}
dst = (GLuint *) ((GLubyte *) dst + dstRowStride);
/*
- * Used to convert 16-bit texels into GLubyte color components.
+ * Used to convert 16-bit texels into GLchan color components.
*/
-static GLubyte R5G6B5toRed[0xffff];
-static GLubyte R5G6B5toGreen[0xffff];
-static GLubyte R5G6B5toBlue[0xffff];
+static GLchan R5G6B5toRed[0xffff];
+static GLchan R5G6B5toGreen[0xffff];
+static GLchan R5G6B5toBlue[0xffff];
-static GLubyte A4R4G4B4toRed[0xffff];
-static GLubyte A4R4G4B4toGreen[0xffff];
-static GLubyte A4R4G4B4toBlue[0xffff];
-static GLubyte A4R4G4B4toAlpha[0xffff];
+static GLchan A4R4G4B4toRed[0xffff];
+static GLchan A4R4G4B4toGreen[0xffff];
+static GLchan A4R4G4B4toBlue[0xffff];
+static GLchan A4R4G4B4toAlpha[0xffff];
-static GLubyte A1R5G5B5toRed[0xffff];
-static GLubyte A1R5G5B5toGreen[0xffff];
-static GLubyte A1R5G5B5toBlue[0xffff];
-static GLubyte A1R5G5B5toAlpha[0xffff];
+static GLchan A1R5G5B5toRed[0xffff];
+static GLchan A1R5G5B5toGreen[0xffff];
+static GLchan A1R5G5B5toBlue[0xffff];
+static GLchan A1R5G5B5toAlpha[0xffff];
static void
generate_lookup_tables(void)
GLint r = (i >> 8) & 0xf8;
GLint g = (i >> 3) & 0xfc;
GLint b = (i << 3) & 0xf8;
- r = r * 255 / 0xf8;
- g = g * 255 / 0xfc;
- b = b * 255 / 0xf8;
+ r = r * CHAN_MAX / 0xf8;
+ g = g * CHAN_MAX / 0xfc;
+ b = b * CHAN_MAX / 0xf8;
R5G6B5toRed[i] = r;
R5G6B5toGreen[i] = g;
R5G6B5toBlue[i] = b;
GLint g = (i >> 4) & 0xf;
GLint b = (i ) & 0xf;
GLint a = (i >> 12) & 0xf;
- r = r * 255 / 0xf;
- g = g * 255 / 0xf;
- b = b * 255 / 0xf;
- a = a * 255 / 0xf;
+ r = r * CHAN_MAX / 0xf;
+ g = g * CHAN_MAX / 0xf;
+ b = b * CHAN_MAX / 0xf;
+ a = a * CHAN_MAX / 0xf;
A4R4G4B4toRed[i] = r;
A4R4G4B4toGreen[i] = g;
A4R4G4B4toBlue[i] = b;
GLint g = (i >> 5) & 0xf8;
GLint b = (i ) & 0xf8;
GLint a = (i >> 15) & 0x1;
- r = r * 255 / 0xf8;
- g = g * 255 / 0xf8;
- b = b * 255 / 0xf8;
- a = a * 255;
+ r = r * CHAN_MAX / 0xf8;
+ g = g * CHAN_MAX / 0xf8;
+ b = b * CHAN_MAX / 0xf8;
+ a = a * CHAN_MAX;
A1R5G5B5toRed[i] = r;
A1R5G5B5toGreen[i] = g;
A1R5G5B5toBlue[i] = b;
GLint srcWidth, GLint srcHeight,
const GLvoid *srcImage, GLint srcRowStride,
GLint dstWidth, GLint dstHeight,
- GLenum dstFormat, GLubyte *dstImage)
+ GLenum dstFormat, GLchan *dstImage)
{
static GLboolean firstCall = GL_TRUE;
const GLint wScale = srcWidth / dstWidth; /* must be power of two */
#endif
if (wScale == 1 && hScale == 1) {
/* easy! */
- MEMCPY(dstImage, srcImage, dstWidth * dstHeight * sizeof(GLubyte));
+ MEMCPY(dstImage, srcImage, dstWidth * dstHeight * sizeof(GLchan));
}
else {
/* rescale */
- const GLubyte *src8 = (const GLubyte *) srcImage;
+ const GLchan *src8 = (const GLchan *) srcImage;
GLint row, col;
for (row = 0; row < dstHeight; row++) {
GLint srcRow = row * hScale;
-/* $Id: texutil.h,v 1.4 2000/08/29 23:30:53 brianp Exp $ */
+/* $Id: texutil.h,v 1.5 2000/10/29 18:12:15 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.4
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
GLint srcWidth, GLint srcHeight,
const GLvoid *srcImage, GLint srcRowStride,
GLint dstWidth, GLint dstHeight,
- GLenum dstFormat, GLubyte *dstImage);
+ GLenum dstFormat, GLchan *dstImage);
extern void