core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

image.c File Reference


Detailed Description

Image handling.

#include "glheader.h"
#include "colormac.h"
#include "context.h"
#include "image.h"
#include "imports.h"
#include "macros.h"
#include "pixel.h"

Defines

#define BYTE_TO_FLOAT(B)   ((B) == 0 ? 0.0F : ((2.0F * (B) + 1.0F) * (1.0F/255.0F)))
 NOTE: Normally, BYTE_TO_FLOAT(0) returns 0.00392 That causes problems when we later convert the float to a packed integer value (such as for GL_RGB5_A1) because we'll wind up with a non-zero value.
#define SHORT_TO_FLOAT(S)   ((S) == 0 ? 0.0F : ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)))
#define CEILING(A, B)   ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
 Compute ceiling of integer quotient of A divided by B.
#define SET_PIXEL(COL, ROW)   destBuffer[(ROW) * destStride + (COL)] = onValue;
#define SWAP2BYTE(VALUE)
#define SWAP4BYTE(VALUE)
#define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION)
#define DEPTH_VALUES(GLTYPE, GLTYPE2FLOAT)

Functions

GLboolean _mesa_type_is_packed (GLenum type)
 
Returns:
GL_TRUE if type is packed pixel type, GL_FALSE otherwise.

static void flip_bytes (GLubyte *p, GLuint n)
 Flip the 8 bits in each byte of the given array.
void _mesa_swap2 (GLushort *p, GLuint n)
 Flip the order of the 2 bytes in each word in the given array.
void _mesa_swap4 (GLuint *p, GLuint n)
GLint _mesa_sizeof_type (GLenum type)
 Get the size of a GL data type.
GLint _mesa_sizeof_packed_type (GLenum type)
 Same as _mesa_sizeof_type() but also accepting the packed pixel format data types.
GLint _mesa_components_in_format (GLenum format)
 Get the number of components in a pixel format.
GLint _mesa_bytes_per_pixel (GLenum format, GLenum type)
 Get the bytes per pixel of pixel format type pair.
GLboolean _mesa_is_legal_format_and_type (GLcontext *ctx, GLenum format, GLenum type)
 Test for a legal pixel format and type.
GLboolean _mesa_is_color_format (GLenum format)
 Test if the given image format is a color/RGBA format (i.e., not color index, depth, stencil, etc).
GLboolean _mesa_is_index_format (GLenum format)
 Test if the given image format is a color index format.
GLboolean _mesa_is_depth_format (GLenum format)
 Test if the given image format is a depth component format.
GLboolean _mesa_is_stencil_format (GLenum format)
 Test if the given image format is a stencil format.
GLboolean _mesa_is_ycbcr_format (GLenum format)
 Test if the given image format is a YCbCr format.
GLboolean _mesa_is_depthstencil_format (GLenum format)
 Test if the given image format is a depth+stencil format.
GLboolean _mesa_is_dudv_format (GLenum format)
 Test if the given image format is a dudv format.
GLvoid * _mesa_image_address (GLuint dimensions, const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column)
 Return the address of a specific pixel in an image (1D, 2D or 3D).
GLvoid * _mesa_image_address1d (const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLenum format, GLenum type, GLint column)
GLvoid * _mesa_image_address2d (const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint row, GLint column)
GLvoid * _mesa_image_address3d (const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column)
GLint _mesa_image_row_stride (const struct gl_pixelstore_attrib *packing, GLint width, GLenum format, GLenum type)
 Compute the stride (in bytes) between image rows.
GLint _mesa_image_image_stride (const struct gl_pixelstore_attrib *packing, GLint width, GLint height, GLenum format, GLenum type)
void _mesa_unpack_polygon_stipple (const GLubyte *pattern, GLuint dest[32], const struct gl_pixelstore_attrib *unpacking)
void _mesa_pack_polygon_stipple (const GLuint pattern[32], GLubyte *dest, const struct gl_pixelstore_attrib *packing)
GLvoid * _mesa_unpack_bitmap (GLint width, GLint height, const GLubyte *pixels, const struct gl_pixelstore_attrib *packing)
void _mesa_pack_bitmap (GLint width, GLint height, const GLubyte *source, GLubyte *dest, const struct gl_pixelstore_attrib *packing)
void _mesa_expand_bitmap (GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap, GLubyte *destBuffer, GLint destStride, GLubyte onValue)
 "Expand" a bitmap from 1-bit per pixel to 8-bits per pixel.
void _mesa_scale_and_bias_rgba (GLuint n, GLfloat rgba[][4], GLfloat rScale, GLfloat gScale, GLfloat bScale, GLfloat aScale, GLfloat rBias, GLfloat gBias, GLfloat bBias, GLfloat aBias)
void _mesa_map_rgba (const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
void _mesa_transform_rgba (const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
void _mesa_lookup_rgba_float (const struct gl_color_table *table, GLuint n, GLfloat rgba[][4])
 Apply a color table lookup to an array of floating point RGBA colors.
void _mesa_lookup_rgba_ubyte (const struct gl_color_table *table, GLuint n, GLubyte rgba[][4])
 Apply a color table lookup to an array of ubyte/RGBA colors.
void _mesa_map_ci_to_rgba (const GLcontext *ctx, GLuint n, const GLuint index[], GLfloat rgba[][4])
void _mesa_map_ci8_to_rgba8 (const GLcontext *ctx, GLuint n, const GLubyte index[], GLubyte rgba[][4])
 Map ubyte color indexes to ubyte/RGBA values.
void _mesa_scale_and_bias_depth (const GLcontext *ctx, GLuint n, GLfloat depthValues[])
void _mesa_scale_and_bias_depth_uint (const GLcontext *ctx, GLuint n, GLuint depthValues[])
static void update_minmax (GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
static void update_histogram (GLcontext *ctx, GLuint n, const GLfloat rgba[][4])
void _mesa_apply_rgba_transfer_ops (GLcontext *ctx, GLbitfield transferOps, GLuint n, GLfloat rgba[][4])
 Apply various pixel transfer operations to an array of RGBA pixels as indicated by the transferOps bitmask.
static void shift_and_offset_ci (const GLcontext *ctx, GLuint n, GLuint indexes[])
void _mesa_apply_ci_transfer_ops (const GLcontext *ctx, GLbitfield transferOps, GLuint n, GLuint indexes[])
 Apply color index shift, offset and table lookup to an array of color indexes;.
void _mesa_apply_stencil_transfer_ops (const GLcontext *ctx, GLuint n, GLstencil stencil[])
 Apply stencil index shift, offset and table lookup to an array of stencil values.
void _mesa_pack_rgba_span_float (GLcontext *ctx, GLuint n, GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps)
 Used to pack an array [][4] of RGBA float colors as specified by the dstFormat, dstType and dstPacking.
static void extract_uint_indexes (GLuint n, GLuint indexes[], GLenum srcFormat, GLenum srcType, const GLvoid *src, const struct gl_pixelstore_attrib *unpack)
static void extract_float_rgba (GLuint n, GLfloat rgba[][4], GLenum srcFormat, GLenum srcType, const GLvoid *src, GLboolean swapBytes)
void _mesa_unpack_color_span_chan (GLcontext *ctx, GLuint n, GLenum dstFormat, GLchan dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps)
void _mesa_unpack_color_span_float (GLcontext *ctx, GLuint n, GLenum dstFormat, GLfloat dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps)
 Same as _mesa_unpack_color_span_chan(), but return GLfloat data instead of GLchan.
void _mesa_unpack_dudv_span_byte (GLcontext *ctx, GLuint n, GLenum dstFormat, GLbyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps)
 Similar to _mesa_unpack_color_span_float(), but for dudv data instead of rgba, directly return GLbyte data, no transfer ops apply.
void _mesa_unpack_index_span (const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps)
void _mesa_pack_index_span (const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLuint *source, const struct gl_pixelstore_attrib *dstPacking, GLbitfield transferOps)
void _mesa_unpack_stencil_span (const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLbitfield transferOps)
void _mesa_pack_stencil_span (const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLstencil *source, const struct gl_pixelstore_attrib *dstPacking)
void _mesa_unpack_depth_span (const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLuint depthMax, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking)
 Unpack a row of depth/z values from memory, returning GLushort, GLuint or GLfloat values.
void _mesa_pack_depth_span (const GLcontext *ctx, GLuint n, GLvoid *dest, GLenum dstType, const GLfloat *depthSpan, const struct gl_pixelstore_attrib *dstPacking)
void _mesa_pack_depth_stencil_span (const GLcontext *ctx, GLuint n, GLuint *dest, const GLfloat *depthVals, const GLstencil *stencilVals, const struct gl_pixelstore_attrib *dstPacking)
 Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.
void * _mesa_unpack_image (GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack)
 Unpack image data.
void _mesa_convert_colors (GLenum srcType, const GLvoid *src, GLenum dstType, GLvoid *dst, GLuint count, const GLubyte mask[])
 Convert an array of RGBA colors from one datatype to another.
GLboolean _mesa_clip_drawpixels (const GLcontext *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *unpack)
 Perform basic clipping for glDrawPixels.
GLboolean _mesa_clip_readpixels (const GLcontext *ctx, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *pack)
 Perform clipping for glReadPixels.
GLboolean _mesa_clip_copytexsubimage (const GLcontext *ctx, GLint *destX, GLint *destY, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height)
 Do clipping for a glCopyTexSubImage call.
GLboolean _mesa_clip_to_region (GLint xmin, GLint ymin, GLint xmax, GLint ymax, GLint *x, GLint *y, GLsizei *width, GLsizei *height)
 Clip the rectangle defined by (x, y, width, height) against the bounds specified by [xmin, xmax) and [ymin, ymax).
static INLINE void clip_right_or_top (GLint *srcX0, GLint *srcX1, GLint *dstX0, GLint *dstX1, GLint maxValue)
 Clip dst coords against Xmax (or Ymax).
static INLINE void clip_left_or_bottom (GLint *srcX0, GLint *srcX1, GLint *dstX0, GLint *dstX1, GLint minValue)
 Clip dst coords against Xmin (or Ymin).
GLboolean _mesa_clip_blit (GLcontext *ctx, GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1, GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1)
 Do clipping of blit src/dest rectangles.


Define Documentation

#define BYTE_TO_FLOAT (  )     ((B) == 0 ? 0.0F : ((2.0F * (B) + 1.0F) * (1.0F/255.0F)))

NOTE: Normally, BYTE_TO_FLOAT(0) returns 0.00392 That causes problems when we later convert the float to a packed integer value (such as for GL_RGB5_A1) because we'll wind up with a non-zero value.

We redefine the macros here so zero is handled correctly.

#define CEILING ( A,
 )     ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )

Compute ceiling of integer quotient of A divided by B.

#define DEPTH_VALUES ( GLTYPE,
GLTYPE2FLOAT   ) 

Value:

do {                                                                \
        GLuint i;                                                       \
        const GLTYPE *src = (const GLTYPE *)source;                     \
        for (i = 0; i < n; i++) {                                       \
            GLTYPE value = src[i];                                      \
            if (srcPacking->SwapBytes) {                                \
                if (sizeof(GLTYPE) == 2) {                              \
                    SWAP2BYTE(value);                                   \
                } else if (sizeof(GLTYPE) == 4) {                       \
                    SWAP4BYTE(value);                                   \
                }                                                       \
            }                                                           \
            depthValues[i] = GLTYPE2FLOAT(value);                       \
        }                                                               \
    } while (0)

#define PROCESS ( INDEX,
CHANNEL,
DEFAULT,
TYPE,
CONVERSION   ) 

Value:

if ((INDEX) < 0) {                                                      \
      GLuint i;                                                         \
      for (i = 0; i < n; i++) {                                         \
         rgba[i][CHANNEL] = DEFAULT;                                    \
      }                                                                 \
   }                                                                    \
   else if (swapBytes) {                                                \
      const TYPE *s = (const TYPE *) src;                               \
      GLuint i;                                                         \
      for (i = 0; i < n; i++) {                                         \
         TYPE value = s[INDEX];                                         \
         if (sizeof(TYPE) == 2) {                                       \
            SWAP2BYTE(value);                                           \
         }                                                              \
         else if (sizeof(TYPE) == 4) {                                  \
            SWAP4BYTE(value);                                           \
         }                                                              \
         rgba[i][CHANNEL] = (GLfloat) CONVERSION(value);                \
         s += stride;                                                   \
      }                                                                 \
   }                                                                    \
   else {                                                               \
      const TYPE *s = (const TYPE *) src;                               \
      GLuint i;                                                         \
      for (i = 0; i < n; i++) {                                         \
         rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]);             \
         s += stride;                                                   \
      }                                                                 \
   }

#define SET_PIXEL ( COL,
ROW   )     destBuffer[(ROW) * destStride + (COL)] = onValue;

#define SHORT_TO_FLOAT (  )     ((S) == 0 ? 0.0F : ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)))

#define SWAP2BYTE ( VALUE   ) 

Value:

{                                               \
      GLubyte *bytes = (GLubyte *) &(VALUE);    \
      GLubyte tmp = bytes[0];                   \
      bytes[0] = bytes[1];                      \
      bytes[1] = tmp;                           \
   }

#define SWAP4BYTE ( VALUE   ) 

Value:

{                                               \
      GLubyte *bytes = (GLubyte *) &(VALUE);    \
      GLubyte tmp = bytes[0];                   \
      bytes[0] = bytes[3];                      \
      bytes[3] = tmp;                           \
      tmp = bytes[1];                           \
      bytes[1] = bytes[2];                      \
      bytes[2] = tmp;                           \
   }


Function Documentation

void _mesa_apply_ci_transfer_ops ( const GLcontext ctx,
GLbitfield  transferOps,
GLuint  n,
GLuint  indexes[] 
)

Apply color index shift, offset and table lookup to an array of color indexes;.

void _mesa_apply_rgba_transfer_ops ( GLcontext ctx,
GLbitfield  transferOps,
GLuint  n,
GLfloat  rgba[][4] 
)

Apply various pixel transfer operations to an array of RGBA pixels as indicated by the transferOps bitmask.

void _mesa_apply_stencil_transfer_ops ( const GLcontext ctx,
GLuint  n,
GLstencil  stencil[] 
)

Apply stencil index shift, offset and table lookup to an array of stencil values.

GLint _mesa_bytes_per_pixel ( GLenum  format,
GLenum  type 
)

Get the bytes per pixel of pixel format type pair.

Parameters:
format pixel format.
type pixel type.
Returns:
bytes per pixel, or -1 if a bad format or type was given.

GLboolean _mesa_clip_blit ( GLcontext ctx,
GLint *  srcX0,
GLint *  srcY0,
GLint *  srcX1,
GLint *  srcY1,
GLint *  dstX0,
GLint *  dstY0,
GLint *  dstX1,
GLint *  dstY1 
)

Do clipping of blit src/dest rectangles.

The dest rect is clipped against both the buffer bounds and scissor bounds. The src rect is just clipped against the buffer bounds.

When either the src or dest rect is clipped, the other is also clipped proportionately!

Note that X0 need not be less than X1 (same for Y) for either the source and dest rects. That makes the clipping a little trickier.

Returns:
GL_TRUE if anything is left to draw, GL_FALSE if totally clipped

GLboolean _mesa_clip_copytexsubimage ( const GLcontext ctx,
GLint *  destX,
GLint *  destY,
GLint *  srcX,
GLint *  srcY,
GLsizei *  width,
GLsizei *  height 
)

Do clipping for a glCopyTexSubImage call.

The framebuffer source region might extend outside the framebuffer bounds. Clip the source region against the framebuffer bounds and adjust the texture/dest position and size accordingly.

Returns:
GL_FALSE if region is totally clipped, GL_TRUE otherwise.

GLboolean _mesa_clip_drawpixels ( const GLcontext ctx,
GLint *  destX,
GLint *  destY,
GLsizei *  width,
GLsizei *  height,
struct gl_pixelstore_attrib unpack 
)

Perform basic clipping for glDrawPixels.

The image's position and size and the unpack SkipPixels and SkipRows are adjusted so that the image region is entirely within the window and scissor bounds. NOTE: this will only work when glPixelZoom is (1, 1) or (1, -1). If Pixel.ZoomY is -1, *destY will be changed to be the first row which we'll actually write. Beforehand, *destY-1 is the first drawing row.

Returns:
GL_TRUE if image is ready for drawing or GL_FALSE if image was completely clipped away (draw nothing)

GLboolean _mesa_clip_readpixels ( const GLcontext ctx,
GLint *  srcX,
GLint *  srcY,
GLsizei *  width,
GLsizei *  height,
struct gl_pixelstore_attrib pack 
)

Perform clipping for glReadPixels.

The image's window position and size, and the pack skipPixels, skipRows and rowLength are adjusted so that the image region is entirely within the window bounds. Note: this is different from _mesa_clip_drawpixels() in that the scissor box is ignored, and we use the bounds of the current readbuffer surface.

Returns:
GL_TRUE if image is ready for drawing or GL_FALSE if image was completely clipped away (draw nothing)

GLboolean _mesa_clip_to_region ( GLint  xmin,
GLint  ymin,
GLint  xmax,
GLint  ymax,
GLint *  x,
GLint *  y,
GLsizei *  width,
GLsizei *  height 
)

Clip the rectangle defined by (x, y, width, height) against the bounds specified by [xmin, xmax) and [ymin, ymax).

Returns:
GL_FALSE if rect is totally clipped, GL_TRUE otherwise.

GLint _mesa_components_in_format ( GLenum  format  ) 

Get the number of components in a pixel format.

Parameters:
format pixel format.
Returns:
the number of components in the given format, or -1 if a bad format.

void _mesa_convert_colors ( GLenum  srcType,
const GLvoid *  src,
GLenum  dstType,
GLvoid *  dst,
GLuint  count,
const GLubyte  mask[] 
)

Convert an array of RGBA colors from one datatype to another.

NOTE: src may equal dst. In that case, we use a temporary buffer.

void _mesa_expand_bitmap ( GLsizei  width,
GLsizei  height,
const struct gl_pixelstore_attrib unpack,
const GLubyte *  bitmap,
GLubyte *  destBuffer,
GLint  destStride,
GLubyte  onValue 
)

"Expand" a bitmap from 1-bit per pixel to 8-bits per pixel.

This is typically used to convert a bitmap into a GLubyte/pixel texture. "On" bits will set texels to onValue. "Off" bits will not modify texels.

Parameters:
width src bitmap width in pixels
height src bitmap height in pixels
unpack bitmap unpacking state
bitmap the src bitmap data
destBuffer start of dest buffer
destStride row stride in dest buffer
onValue if bit is 1, set destBuffer pixel to this value

GLvoid* _mesa_image_address ( GLuint  dimensions,
const struct gl_pixelstore_attrib packing,
const GLvoid *  image,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLenum  type,
GLint  img,
GLint  row,
GLint  column 
)

Return the address of a specific pixel in an image (1D, 2D or 3D).

Pixel unpacking/packing parameters are observed according to packing.

Parameters:
dimensions either 1, 2 or 3 to indicate dimensionality of image
image starting address of image data
width the image width
height theimage height
format the pixel format
type the pixel data type
packing the pixelstore attributes
img which image in the volume (0 for 1D or 2D images)
row row of pixel in the image (0 for 1D images)
column column of pixel in the image
Returns:
address of pixel on success, or NULL on error.
See also:
gl_pixelstore_attrib.

GLvoid* _mesa_image_address1d ( const struct gl_pixelstore_attrib packing,
const GLvoid *  image,
GLsizei  width,
GLenum  format,
GLenum  type,
GLint  column 
)

GLvoid* _mesa_image_address2d ( const struct gl_pixelstore_attrib packing,
const GLvoid *  image,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLenum  type,
GLint  row,
GLint  column 
)

GLvoid* _mesa_image_address3d ( const struct gl_pixelstore_attrib packing,
const GLvoid *  image,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLenum  type,
GLint  img,
GLint  row,
GLint  column 
)

GLint _mesa_image_image_stride ( const struct gl_pixelstore_attrib packing,
GLint  width,
GLint  height,
GLenum  format,
GLenum  type 
)

GLint _mesa_image_row_stride ( const struct gl_pixelstore_attrib packing,
GLint  width,
GLenum  format,
GLenum  type 
)

Compute the stride (in bytes) between image rows.

Parameters:
packing the pixelstore attributes
width image width.
format pixel format.
type pixel data type.
Returns:
the stride in bytes for the given parameters, or -1 if error

GLboolean _mesa_is_color_format ( GLenum  format  ) 

Test if the given image format is a color/RGBA format (i.e., not color index, depth, stencil, etc).

Parameters:
format the image format value (may by an internal texture format)
Returns:
GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.

GLboolean _mesa_is_depth_format ( GLenum  format  ) 

Test if the given image format is a depth component format.

GLboolean _mesa_is_depthstencil_format ( GLenum  format  ) 

Test if the given image format is a depth+stencil format.

GLboolean _mesa_is_dudv_format ( GLenum  format  ) 

Test if the given image format is a dudv format.

GLboolean _mesa_is_index_format ( GLenum  format  ) 

Test if the given image format is a color index format.

GLboolean _mesa_is_legal_format_and_type ( GLcontext ctx,
GLenum  format,
GLenum  type 
)

Test for a legal pixel format and type.

Parameters:
format pixel format.
type pixel type.
Returns:
GL_TRUE if the given pixel format and type are legal, or GL_FALSE otherwise.

GLboolean _mesa_is_stencil_format ( GLenum  format  ) 

Test if the given image format is a stencil format.

GLboolean _mesa_is_ycbcr_format ( GLenum  format  ) 

Test if the given image format is a YCbCr format.

void _mesa_lookup_rgba_float ( const struct gl_color_table table,
GLuint  n,
GLfloat  rgba[][4] 
)

Apply a color table lookup to an array of floating point RGBA colors.

void _mesa_lookup_rgba_ubyte ( const struct gl_color_table table,
GLuint  n,
GLubyte  rgba[][4] 
)

Apply a color table lookup to an array of ubyte/RGBA colors.

void _mesa_map_ci8_to_rgba8 ( const GLcontext ctx,
GLuint  n,
const GLubyte  index[],
GLubyte  rgba[][4] 
)

Map ubyte color indexes to ubyte/RGBA values.

void _mesa_map_ci_to_rgba ( const GLcontext ctx,
GLuint  n,
const GLuint  index[],
GLfloat  rgba[][4] 
)

void _mesa_map_rgba ( const GLcontext ctx,
GLuint  n,
GLfloat  rgba[][4] 
)

void _mesa_pack_bitmap ( GLint  width,
GLint  height,
const GLubyte *  source,
GLubyte *  dest,
const struct gl_pixelstore_attrib packing 
)

void _mesa_pack_depth_span ( const GLcontext ctx,
GLuint  n,
GLvoid *  dest,
GLenum  dstType,
const GLfloat *  depthSpan,
const struct gl_pixelstore_attrib dstPacking 
)

void _mesa_pack_depth_stencil_span ( const GLcontext ctx,
GLuint  n,
GLuint *  dest,
const GLfloat *  depthVals,
const GLstencil *  stencilVals,
const struct gl_pixelstore_attrib dstPacking 
)

Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.

void _mesa_pack_index_span ( const GLcontext ctx,
GLuint  n,
GLenum  dstType,
GLvoid *  dest,
const GLuint *  source,
const struct gl_pixelstore_attrib dstPacking,
GLbitfield  transferOps 
)

void _mesa_pack_polygon_stipple ( const GLuint  pattern[32],
GLubyte *  dest,
const struct gl_pixelstore_attrib packing 
)

void _mesa_pack_rgba_span_float ( GLcontext ctx,
GLuint  n,
GLfloat  rgba[][4],
GLenum  dstFormat,
GLenum  dstType,
GLvoid *  dstAddr,
const struct gl_pixelstore_attrib dstPacking,
GLbitfield  transferOps 
)

Used to pack an array [][4] of RGBA float colors as specified by the dstFormat, dstType and dstPacking.

Used by glReadPixels, glGetConvolutionFilter(), etc. Note: the rgba values will be modified by this function when any pixel transfer ops are enabled.

void _mesa_pack_stencil_span ( const GLcontext ctx,
GLuint  n,
GLenum  dstType,
GLvoid *  dest,
const GLstencil *  source,
const struct gl_pixelstore_attrib dstPacking 
)

void _mesa_scale_and_bias_depth ( const GLcontext ctx,
GLuint  n,
GLfloat  depthValues[] 
)

void _mesa_scale_and_bias_depth_uint ( const GLcontext ctx,
GLuint  n,
GLuint  depthValues[] 
)

void _mesa_scale_and_bias_rgba ( GLuint  n,
GLfloat  rgba[][4],
GLfloat  rScale,
GLfloat  gScale,
GLfloat  bScale,
GLfloat  aScale,
GLfloat  rBias,
GLfloat  gBias,
GLfloat  bBias,
GLfloat  aBias 
)

GLint _mesa_sizeof_packed_type ( GLenum  type  ) 

Same as _mesa_sizeof_type() but also accepting the packed pixel format data types.

GLint _mesa_sizeof_type ( GLenum  type  ) 

Get the size of a GL data type.

Parameters:
type GL data type.
Returns:
the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1 if an invalid type enum.

void _mesa_swap2 ( GLushort *  p,
GLuint  n 
)

Flip the order of the 2 bytes in each word in the given array.

Parameters:
p array.
n number of words.

void _mesa_swap4 ( GLuint *  p,
GLuint  n 
)

void _mesa_transform_rgba ( const GLcontext ctx,
GLuint  n,
GLfloat  rgba[][4] 
)

GLboolean _mesa_type_is_packed ( GLenum  type  ) 

Returns:
GL_TRUE if type is packed pixel type, GL_FALSE otherwise.

GLvoid* _mesa_unpack_bitmap ( GLint  width,
GLint  height,
const GLubyte *  pixels,
const struct gl_pixelstore_attrib packing 
)

void _mesa_unpack_color_span_chan ( GLcontext ctx,
GLuint  n,
GLenum  dstFormat,
GLchan  dest[],
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking,
GLbitfield  transferOps 
)

void _mesa_unpack_color_span_float ( GLcontext ctx,
GLuint  n,
GLenum  dstFormat,
GLfloat  dest[],
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking,
GLbitfield  transferOps 
)

Same as _mesa_unpack_color_span_chan(), but return GLfloat data instead of GLchan.

void _mesa_unpack_depth_span ( const GLcontext ctx,
GLuint  n,
GLenum  dstType,
GLvoid *  dest,
GLuint  depthMax,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking 
)

Unpack a row of depth/z values from memory, returning GLushort, GLuint or GLfloat values.

The glPixelTransfer (scale/bias) params will be applied.

Parameters:
dstType one of GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT
depthMax max value for returned GLushort or GLuint values (ignored for GLfloat).

void _mesa_unpack_dudv_span_byte ( GLcontext ctx,
GLuint  n,
GLenum  dstFormat,
GLbyte  dest[],
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking,
GLbitfield  transferOps 
)

Similar to _mesa_unpack_color_span_float(), but for dudv data instead of rgba, directly return GLbyte data, no transfer ops apply.

void* _mesa_unpack_image ( GLuint  dimensions,
GLsizei  width,
GLsizei  height,
GLsizei  depth,
GLenum  format,
GLenum  type,
const GLvoid *  pixels,
const struct gl_pixelstore_attrib unpack 
)

Unpack image data.

Apply byte swapping, byte flipping (bitmap). Return all image data in a contiguous block. This is used when we compile glDrawPixels, glTexImage, etc into a display list. We need a copy of the data in a standard format.

void _mesa_unpack_index_span ( const GLcontext ctx,
GLuint  n,
GLenum  dstType,
GLvoid *  dest,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking,
GLbitfield  transferOps 
)

void _mesa_unpack_polygon_stipple ( const GLubyte *  pattern,
GLuint  dest[32],
const struct gl_pixelstore_attrib unpacking 
)

void _mesa_unpack_stencil_span ( const GLcontext ctx,
GLuint  n,
GLenum  dstType,
GLvoid *  dest,
GLenum  srcType,
const GLvoid *  source,
const struct gl_pixelstore_attrib srcPacking,
GLbitfield  transferOps 
)

static INLINE void clip_left_or_bottom ( GLint *  srcX0,
GLint *  srcX1,
GLint *  dstX0,
GLint *  dstX1,
GLint  minValue 
) [static]

Clip dst coords against Xmin (or Ymin).

static INLINE void clip_right_or_top ( GLint *  srcX0,
GLint *  srcX1,
GLint *  dstX0,
GLint *  dstX1,
GLint  maxValue 
) [static]

Clip dst coords against Xmax (or Ymax).

static void extract_float_rgba ( GLuint  n,
GLfloat  rgba[][4],
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  src,
GLboolean  swapBytes 
) [static]

static void extract_uint_indexes ( GLuint  n,
GLuint  indexes[],
GLenum  srcFormat,
GLenum  srcType,
const GLvoid *  src,
const struct gl_pixelstore_attrib unpack 
) [static]

static void flip_bytes ( GLubyte *  p,
GLuint  n 
) [static]

Flip the 8 bits in each byte of the given array.

Parameters:
p array.
n number of bytes.
Todo:
try this trick to flip bytes someday:
  v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555);
  v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333);
  v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f);

static void shift_and_offset_ci ( const GLcontext ctx,
GLuint  n,
GLuint  indexes[] 
) [static]

static void update_histogram ( GLcontext ctx,
GLuint  n,
const GLfloat  rgba[][4] 
) [static]

static void update_minmax ( GLcontext ctx,
GLuint  n,
const GLfloat  rgba[][4] 
) [static]


Generated on Sun Sep 27 06:47:46 2009 for Mesa Main by  doxygen 1.5.4