diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-03-30 18:37:51 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-03-30 18:37:51 +0000 |
commit | e5d68a2b7dba4d4402ee117dcaebde0b35c87956 (patch) | |
tree | 9a715b74b49ae615d05467c7b5f54dbef3fafce0 /src | |
parent | aed8a96ef22f29b29315c14af6e2148bb9e2bbda (diff) |
improved PrintTexture debug function
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/teximage.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 81f6852baf..ae50558bf2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -50,19 +50,48 @@ #ifdef DEBUG -static void PrintTexture(int w, int h, int c, const GLubyte *data) +static void PrintTexture(const struct gl_texture_image *img) { - int i, j; - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { + int i, j, c; + GLubyte *data = img->Data; + + if (!data) { + printf("No texture data\n"); + return; + } + + switch (img->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + c = 1; + break; + case GL_LUMINANCE_ALPHA: + c = 2; + break; + case GL_RGB: + c = 3; + break; + case GL_RGBA: + c = 4; + break; + default: + gl_problem(NULL, "error in PrintTexture\n"); + return; + } + + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { if (c==1) printf("%02x ", data[0]); else if (c==2) - printf("%02x %02x ", data[0], data[1]); + printf("%02x%02x ", data[0], data[1]); else if (c==3) - printf("%02x %02x %02x ", data[0], data[1], data[2]); + printf("%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) - printf("%02x %02x %02x %02x ", data[0], data[1], data[2], data[3]); + printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += c; } printf("\n"); |