340 if (teximage->
Data) {
362 GLint numPixels, pixel;
383 if (
image->Height==1)
395 if (!texImage->
Data) {
402 if (
ctx->Pixel.RedScale!=1.0F ||
ctx->Pixel.RedBias!=0.0F ||
403 ctx->Pixel.GreenScale!=1.0F ||
ctx->Pixel.GreenBias!=0.0F ||
404 ctx->Pixel.BlueScale!=1.0F ||
ctx->Pixel.BlueBias!=0.0F ||
405 ctx->Pixel.AlphaScale!=1.0F ||
ctx->Pixel.AlphaBias!=0.0F) {
412 switch (
image->Type) {
418 GLint rMask =
ctx->Pixel.MapItoRsize-1;
419 GLint gMask =
ctx->Pixel.MapItoGsize-1;
420 GLint bMask =
ctx->Pixel.MapItoBsize-1;
421 GLint aMask =
ctx->Pixel.MapItoAsize-1;
434 index = (*srcPtr & bitMask) ? 1 : 0;
435 bitMask = bitMask >> 1;
455 switch (texImage->
Format) {
463 texImage->
Data[pixel*2+0] =
red;
470 texImage->
Data[pixel*3+0] =
red;
475 texImage->
Data[pixel*4+0] =
red;
493 for (pixel=0; pixel<numPixels; pixel++) {
495 switch (
image->Format) {
577 if (scaleOrBias ||
ctx->Pixel.MapColorFlag) {
585 r =
r *
ctx->Pixel.RedScale +
ctx->Pixel.RedBias;
586 g =
g *
ctx->Pixel.GreenScale +
ctx->Pixel.GreenBias;
587 b =
b *
ctx->Pixel.BlueScale +
ctx->Pixel.BlueBias;
588 a =
a *
ctx->Pixel.AlphaScale +
ctx->Pixel.AlphaBias;
595 if (
ctx->Pixel.MapColorFlag) {
600 r =
ctx->Pixel.MapRtoR[ir];
601 g =
ctx->Pixel.MapGtoG[ig];
602 b =
ctx->Pixel.MapBtoB[ib];
603 a =
ctx->Pixel.MapAtoA[ia];
612 switch (texImage->
Format) {
623 texImage->
Data[pixel*2+0] =
red;
630 texImage->
Data[pixel*3+0] =
red;
635 texImage->
Data[pixel*4+0] =
red;
648 for (pixel=0; pixel<numPixels; pixel++) {
650 switch (texImage->
Format) {
661 GLint rMask =
ctx->Pixel.MapItoRsize-1;
662 GLint gMask =
ctx->Pixel.MapItoGsize-1;
663 GLint bMask =
ctx->Pixel.MapItoBsize-1;
664 GLint aMask =
ctx->Pixel.MapItoAsize-1;
748 if (
ctx->Pixel.MapColorFlag) {
753 red =
ctx->Pixel.MapRtoR[ir];
761 switch (texImage->
Format) {
852 if (texImage->
Data) {
857 " X X XXXX XXX XXXXX ",
860 " X X XXXXX XXX X X ",
921 "glTexImage1D(width != 2^k + 2*border)");
1002 "glTexImage2D(width != 2^k + 2*border)");
1007 "glTexImage2D(height != 2^k + 2*border)");
1068 if (
ctx->Texture.Current1D->Image[
level]) {
1082 ctx->Texture.Current1D->Image[
level] = teximage;
1094 if (
ctx->Driver.TexImage) {
1096 ctx->Texture.Current1D,
1113 ctx->Texture.Proxy1D->Image[
level]->Height = 1;
1153 if (
ctx->Texture.Current2D->Image[
level]) {
1167 ctx->Texture.Current2D->Image[
level] = teximage;
1179 if (
ctx->Driver.TexImage) {
1181 ctx->Texture.Current2D,
1265 destTex =
ctx->Texture.Current1D->Image[
level];
1302 if (
image->RefCount==0) {
1310 if (
ctx->Driver.TexSubImage) {
1314 ctx->Texture.Current1D->Image[
level]->IntFormat,
1318 if (
ctx->Driver.TexImage) {
1320 ctx->Texture.Current1D,
1374 destTex =
ctx->Texture.Current2D->Image[
level];
1431 if (
image->RefCount==0) {
1439 if (
ctx->Driver.TexSubImage) {
1442 ctx->Texture.Current2D->Image[
level]->IntFormat,
1446 if (
ctx->Driver.TexImage) {
1514 image->RefCount = 0;
1528 (
void) (*
ctx->Driver.SetBuffer)(
ctx,
ctx->Pixel.ReadBuffer );
1535 if (!
ctx->Visual->EightBitColor) {
1537 GLfloat rscale = 255.0f *
ctx->Visual->InvRedScale;
1538 GLfloat gscale = 255.0f *
ctx->Visual->InvGreenScale;
1539 GLfloat bscale = 255.0f *
ctx->Visual->InvBlueScale;
1540 GLfloat ascale = 255.0f *
ctx->Visual->InvAlphaScale;
1575 *imgptr++ =
blue[
i];
1582 *imgptr++ =
blue[
i];
1591 (
void) (*
ctx->Driver.SetBuffer)(
ctx,
ctx->Color.DrawBuffer );
1723 if (!
ctx->Visual->EightBitColor) {
1725 GLfloat rscale = 255.0f *
ctx->Visual->InvRedScale;
1726 GLfloat gscale = 255.0f *
ctx->Visual->InvGreenScale;
1727 GLfloat bscale = 255.0f *
ctx->Visual->InvBlueScale;
1728 GLfloat ascale = 255.0f *
ctx->Visual->InvAlphaScale;
1765 *texptr++ =
blue[
i];
1772 *texptr++ =
blue[
i];
1806 teximage =
ctx->Texture.Current1D->Image[
level];
1816 "glCopyTexSubImage1D(xoffset+width)" );
1819 if (teximage->
Data) {
1858 teximage =
ctx->Texture.Current2D->Image[
level];
1872 "glCopyTexSubImage2D(xoffset+width)" );
1877 "glCopyTexSubImage2D(yoffset+height)" );
1881 if (teximage->
Data) {
#define MAX_TEXTURE_LEVELS
void gl_problem(const GLcontext *ctx, const char *s)
void gl_error(GLcontext *ctx, GLenum error, const char *s)
GLint gl_sizeof_type(GLenum type)
GLint gl_components_in_format(GLenum format)
struct gl_image * gl_unpack_image(GLcontext *ctx, GLint width, GLint height, GLenum srcFormat, GLenum srcType, const GLvoid *pixels)
void gl_free_image(struct gl_image *image)
GLint GLint GLsizei GLsizei GLsizei GLint border
GLint GLint GLsizei GLsizei GLsizei depth
#define GL_UNSIGNED_SHORT
GLint GLint GLint GLint GLint x
#define GL_LUMINANCE_ALPHA
#define GL_PROXY_TEXTURE_2D
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
#define GL_LUMINANCE4_ALPHA4
GLuint GLuint GLsizei GLenum type
#define GL_INVALID_OPERATION
GLclampf GLclampf GLclampf alpha
#define GL_LUMINANCE12_ALPHA4
GLint GLint GLint GLint GLint GLint y
#define GL_LUMINANCE12_ALPHA12
#define GL_LUMINANCE16_ALPHA16
GLint GLint internalformat
#define GL_LUMINANCE8_ALPHA8
GLint GLint GLsizei GLsizei height
#define GL_DEPTH_COMPONENT
GLdouble GLdouble GLdouble r
#define GL_LUMINANCE6_ALPHA2
GLint GLint GLsizei width
GLint GLint GLint yoffset
#define GL_PROXY_TEXTURE_1D
#define GL_COLOR_INDEX12_EXT
GLenum GLenum GLuint components
#define GL_COLOR_INDEX4_EXT
#define GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX1_EXT
GLboolean GLboolean GLboolean b
#define GL_COLOR_INDEX2_EXT
#define GL_COLOR_INDEX16_EXT
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_ __CRT_INLINE double log2(_In_ double x)
#define MEMSET(DST, VAL, N)
#define MEMCPY(DST, SRC, BYTES)
#define INSIDE_BEGIN_END(CTX)
void gl_read_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[])
void gl_TexSubImage2D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, struct gl_image *image)
struct gl_texture_image * gl_alloc_texture_image(void)
void gl_TexImage2D(GLcontext *ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, struct gl_image *image)
void gl_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
static GLboolean texture_1d_error_check(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLenum format, GLenum type, GLint width, GLint border)
void gl_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
void gl_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, struct gl_image *image)
static struct gl_image * read_color_image(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLint format)
void gl_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
struct gl_image * gl_unpack_texsubimage(GLcontext *ctx, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels)
static void copy_tex_sub_image(GLcontext *ctx, struct gl_texture_image *dest, GLint width, GLint height, GLint srcx, GLint srcy, GLint dstx, GLint dsty)
void gl_TexImage1D(GLcontext *ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, struct gl_image *image)
static struct gl_texture_image * make_null_texture(GLcontext *ctx, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border)
static GLboolean texture_2d_error_check(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint border)
static int logbase2(int n)
void gl_free_texture_image(struct gl_texture_image *teximage)
static GLint decode_internal_format(GLint format)
void gl_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
static struct gl_texture_image * image_to_texture(GLcontext *ctx, const struct gl_image *image, GLenum internalFormat, GLint border)
static GLint components_in_intformat(GLint format)
void gl_GetTexImage(GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
#define CLAMP(f, min, max)