From 91bebf1bfa5b9193d74f02a624cfc6a353198f3d Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Fri, 21 Mar 2003 22:08:46 +0000 Subject: [PATCH] Don't need LA for greyscale textures, switch to luminance-only. --- include/QF/texture.h | 2 ++ libs/util/tga.c | 17 +++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/QF/texture.h b/include/QF/texture.h index bc48035c8..439af4a2b 100644 --- a/include/QF/texture.h +++ b/include/QF/texture.h @@ -42,6 +42,8 @@ typedef struct tex_s { } tex_t; #define tex_palette 0 +#define tex_l GL_LUMINANCE +#define tex_a GL_ALPHA #define tex_la 2 #define tex_rgb 3 #define tex_rgba 4 diff --git a/libs/util/tga.c b/libs/util/tga.c index ac2686117..e487f6167 100644 --- a/libs/util/tga.c +++ b/libs/util/tga.c @@ -46,6 +46,7 @@ static __attribute__ ((unused)) const char rcsid[] = #include "QF/texture.h" #include "QF/tga.h" #include "QF/zone.h" +#include "QF/GL/defines.h" #include "compat.h" @@ -106,20 +107,18 @@ reverse_blit_rgba (byte *buf, int count, byte red, byte green, byte blue, } static inline byte * -blit_la (byte *buf, int count, byte lum, byte alpha) +blit_l (byte *buf, int count, byte lum) { while (count--) { *buf++ = lum; - *buf++ = alpha; } return buf; } static inline byte * -reverse_blit_la (byte *buf, int count, byte lum, byte alpha) +reverse_blit_l (byte *buf, int count, byte lum) { while (count--) { - *buf-- = alpha; *buf-- = lum; } return buf; @@ -195,18 +194,16 @@ static inline byte * read_l (byte *buf, int count, byte **data, cmap_t *cmap) { byte lum = *(*data)++; - byte alpha = 255; - return blit_la (buf, count, lum, alpha); + return blit_l (buf, count, lum); } static inline byte * reverse_read_l (byte *buf, int count, byte **data, cmap_t *cmap) { byte lum = *(*data)++; - byte alpha = 255; - return reverse_blit_la (buf, count, lum, alpha); + return reverse_blit_l (buf, count, lum); } static inline void @@ -558,7 +555,7 @@ decode_greyscale (TargaHeader *targa, tex_t *tex, byte *dataByte) if (targa->pixel_size != 8) Sys_Error ("LoadTGA: unsupported truecolor pixel size"); - tex->format = tex_la; + tex->format = tex_l; columns = targa->width; rows = targa->height; @@ -595,7 +592,7 @@ decode_greyscale_rle (TargaHeader *targa, tex_t *tex, byte *dataByte) if (targa->pixel_size != 8) Sys_Error ("LoadTGA: unsupported truecolor pixel size"); - tex->format = tex_la; + tex->format = tex_l; columns = targa->width; rows = targa->height;