From 06fedddb4d8610383a1d1df9a6bcfac92dc85a94 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Tue, 30 Jan 2018 02:56:16 -0800 Subject: [PATCH] fix stb_dxt.h; fix misspelled STB_DXT_IMPLEMENTATION in test jig --- stb_dxt.h | 20 ++++++++++---------- tests/test_c_compilation.c | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/stb_dxt.h b/stb_dxt.h index 541cdc1..2fa84fa 100644 --- a/stb_dxt.h +++ b/stb_dxt.h @@ -1,4 +1,4 @@ -// stb_dxt.h - v1.08 - DXT1/DXT5 compressor - public domain +// stb_dxt.h - v1.08b - DXT1/DXT5 compressor - public domain // original by fabian "ryg" giesen - ported to C by stb // use '#define STB_DXT_IMPLEMENTATION' before including to create the implementation // @@ -32,11 +32,6 @@ #ifndef STB_INCLUDE_STB_DXT_H #define STB_INCLUDE_STB_DXT_H -// compression mode (bitflags) -#define STB_DXT_NORMAL 0 -#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like! -#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower. - #ifdef __cplusplus extern "C" { #endif @@ -47,15 +42,21 @@ extern "C" { #define STBDDEF extern #endif +// compression mode (bitflags) +#define STB_DXT_NORMAL 0 +#define STB_DXT_DITHER 1 // use dithering. dubious win. never use for normal maps and the like! +#define STB_DXT_HIGHQUAL 2 // high quality mode, does two refinement steps instead of 1. ~30-40% slower. + STBDDEF void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src_rgba_four_bytes_per_pixel, int alpha, int mode); STBDDEF void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src_r_one_byte_per_pixel); STBDDEF void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src_rg_two_byte_per_pixel); +#define STB_COMPRESS_DXT_BLOCK + #ifdef __cplusplus } #endif - -#define STB_COMPRESS_DXT_BLOCK +#endif // STB_INCLUDE_STB_DXT_H #ifdef STB_DXT_IMPLEMENTATION @@ -650,7 +651,7 @@ static void stb__InitDXT() void stb_compress_dxt_block(unsigned char *dest, const unsigned char *src, int alpha, int mode) { - unsigned char *data[16][4]; + unsigned char data[16][4]; static int init=1; if (init) { stb__InitDXT(); @@ -683,7 +684,6 @@ void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src) stb__CompressAlphaBlock(dest + 8,(unsigned char*) src+1,2); } #endif // STB_DXT_IMPLEMENTATION -#endif // STB_INCLUDE_STB_DXT_H /* ------------------------------------------------------------------------------ diff --git a/tests/test_c_compilation.c b/tests/test_c_compilation.c index 2a54df5..3dd6c16 100644 --- a/tests/test_c_compilation.c +++ b/tests/test_c_compilation.c @@ -4,7 +4,6 @@ #define STB_PERLIN_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION -#define STB_DXT_IMPLEMENATION #define STB_C_LEXER_IMPLEMENTATIOn #define STB_DIVIDE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION @@ -19,12 +18,14 @@ #include "stb_image.h" #include "stb_image_write.h" #include "stb_perlin.h" -#include "stb_dxt.h" #include "stb_c_lexer.h" #include "stb_divide.h" #include "stb_image_resize.h" #include "stb_rect_pack.h" +#define STB_DXT_IMPLEMENTATION +#include "stb_dxt.h" + #define STBVOX_CONFIG_MODE 1 #include "stb_voxel_render.h"