From 48710234f283ec106d429a28d53436133734d121 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 15 Jan 2017 23:57:53 -0800 Subject: [PATCH] credits; 1/2/4-bit png fix; easy font spacing; NO_STDIO in image_write --- stb_easy_font.h | 11 ++++++++--- stb_image.h | 7 +++++-- stb_image_write.h | 1 + stb_sprintf.h | 20 ++++++++++++++++---- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/stb_easy_font.h b/stb_easy_font.h index 45bddc9..579dec0 100644 --- a/stb_easy_font.h +++ b/stb_easy_font.h @@ -1,4 +1,4 @@ -// stb_easy_font.h - v0.7 - bitmap font for 3D rendering - public domain +// stb_easy_font.h - v1.0 - bitmap font for 3D rendering - public domain // Sean Barrett, Feb 2015 // // Easy-to-deploy, @@ -73,9 +73,14 @@ // // VERSION HISTORY // +// (2017-01-15) 1.0 space character takes same space as numbers; fix bad spacing of 'f' // (2016-01-22) 0.7 width() supports multiline text; add height() // (2015-09-13) 0.6 #include ; updated license // (2015-02-01) 0.5 First release +// +// CONTRIBUTORS +// +// github:vassvik -- bug report #if 0 // SAMPLE CODE: @@ -109,7 +114,7 @@ struct { unsigned char h_seg; unsigned char v_seg; } stb_easy_font_charinfo[96] = { - { 5, 0, 0 }, { 3, 0, 0 }, { 5, 1, 1 }, { 7, 1, 4 }, + { 6, 0, 0 }, { 3, 0, 0 }, { 5, 1, 1 }, { 7, 1, 4 }, { 7, 3, 7 }, { 7, 6, 12 }, { 7, 8, 19 }, { 4, 16, 21 }, { 4, 17, 22 }, { 4, 19, 23 }, { 23, 21, 24 }, { 23, 22, 31 }, { 20, 23, 34 }, { 22, 23, 36 }, { 19, 24, 36 }, { 21, 25, 36 }, @@ -126,7 +131,7 @@ struct { { 7,109,165 }, { 7,118,167 }, { 6,118,172 }, { 4,120,176 }, { 6,122,177 }, { 4,122,181 }, { 23,124,182 }, { 22,129,182 }, { 4,130,182 }, { 22,131,183 }, { 6,133,187 }, { 22,135,191 }, - { 6,137,192 }, { 22,139,196 }, { 5,144,197 }, { 22,147,198 }, + { 6,137,192 }, { 22,139,196 }, { 6,144,197 }, { 22,147,198 }, { 6,150,202 }, { 19,151,206 }, { 21,152,207 }, { 6,155,209 }, { 3,160,210 }, { 23,160,211 }, { 22,164,216 }, { 22,165,220 }, { 22,167,224 }, { 22,169,228 }, { 21,171,232 }, { 21,173,233 }, diff --git a/stb_image.h b/stb_image.h index 345e406..e9f2dc5 100644 --- a/stb_image.h +++ b/stb_image.h @@ -192,7 +192,7 @@ Ryamond Barbiero Paul Du Bois Engin Manap snagar@github Michaelangel007@github Oriol Ferrer Mesia socks-the-fox Zelex@github Philipp Wiesemann Josh Tobin rlyeh@github grim210@github - Blazej Dariusz Roszkowski + Blazej Dariusz Roszkowski Dale Weiler LICENSE @@ -4842,7 +4842,10 @@ static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, st void *result=NULL; if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) { - ri->bits_per_channel = p->depth; + if (p->depth < 8) + ri->bits_per_channel = 8; + else + ri->bits_per_channel = p->depth; result = p->out; p->out = NULL; if (req_comp && req_comp != p->s->img_out_n) { diff --git a/stb_image_write.h b/stb_image_write.h index c247e34..7bc2ca8 100644 --- a/stb_image_write.h +++ b/stb_image_write.h @@ -103,6 +103,7 @@ CREDITS: Jonas Karlsson Filip Wasil Thatcher Ulrich + github:poppolopoppo LICENSE diff --git a/stb_sprintf.h b/stb_sprintf.h index 81e757c..474426c 100644 --- a/stb_sprintf.h +++ b/stb_sprintf.h @@ -4,6 +4,9 @@ // // allowed types: sc uidBboXx p AaGgEef n // lengths : h ll j z t I64 I32 I +// +// Contributors (bugfixes): +// github:d26435 #ifndef STB_SPRINTF_H_INCLUDE #define STB_SPRINTF_H_INCLUDE @@ -118,16 +121,25 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC): "...512 char string..." ( 35.0x/32.5x faster!) */ +#if defined(__has_feature) + #if __has_feature(address_sanitizer) + #define STBI__ASAN __attribute__((no_sanitize("address"))) + #endif +#endif +#ifndef STBI__ASAN +#define STBI__ASAN +#endif + #ifdef STB_SPRINTF_STATIC #define STBSP__PUBLICDEC static -#define STBSP__PUBLICDEF static +#define STBSP__PUBLICDEF static STBI__ASAN #else #ifdef __cplusplus #define STBSP__PUBLICDEC extern "C" -#define STBSP__PUBLICDEF extern "C" +#define STBSP__PUBLICDEF extern "C" STBI__ASAN #else -#define STBSP__PUBLICDEC extern -#define STBSP__PUBLICDEF +#define STBSP__PUBLICDEC extern +#define STBSP__PUBLICDEF STBI__ASAN #endif #endif -- GitLab