Merge branch 'misc-typos' of https://github.com/luzpaz/stb into working
This commit is contained in:
commit
3005bcfe87
10
stb.h
10
stb.h
@ -3106,13 +3106,13 @@ typedef struct
|
||||
// (internal) change the allocated length of the array
|
||||
#define stb_arr__grow(a,n) (stb_arr_check(a), stb_arrhead(a)->len += (n))
|
||||
|
||||
// add N new unitialized elements to the end of the array
|
||||
// add N new uninitialized elements to the end of the array
|
||||
#define stb_arr__addn(a,n) /*lint --e(826)*/ \
|
||||
((stb_arr_len(a)+(n) > stb_arrcurmax(a)) \
|
||||
? (stb__arr_addlen((void **) &(a),sizeof(*a),(n)),0) \
|
||||
: ((stb_arr__grow(a,n), 0)))
|
||||
|
||||
// add N new unitialized elements to the end of the array, and return
|
||||
// add N new uninitialized elements to the end of the array, and return
|
||||
// a pointer to the first new one
|
||||
#define stb_arr_addn(a,n) (stb_arr__addn((a),n),(a)+stb_arr_len(a)-(n))
|
||||
|
||||
@ -8682,7 +8682,7 @@ static void STB_(FUNCNAME,_ins_sort)(TYPE *p, int n) \
|
||||
\
|
||||
static void STB_(FUNCNAME,_quicksort)(TYPE *p, int n) \
|
||||
{ \
|
||||
/* threshhold for transitioning to insertion sort */ \
|
||||
/* threshold for transitioning to insertion sort */ \
|
||||
while (n > 12) { \
|
||||
TYPE *a,*b,t; \
|
||||
int c01,c12,c,m,i,j; \
|
||||
@ -13864,7 +13864,7 @@ static void stu__pop_func_comp(void)
|
||||
|
||||
// if an id is a reference to an outer lexical scope, this
|
||||
// function returns the "name" of it, and updates the stack
|
||||
// structures to make sure the names are propogated in.
|
||||
// structures to make sure the names are propagated in.
|
||||
static int stu__nonlocal_id(stua_obj var_obj)
|
||||
{
|
||||
stua_obj dummy, var = var_obj;
|
||||
@ -13879,7 +13879,7 @@ static int stu__nonlocal_id(stua_obj var_obj)
|
||||
for (i=0; i < stb_arr_len(stu__pfunc.non_local_refs); ++i)
|
||||
if (stu__pfunc.non_local_refs[i] == j) return j-n;
|
||||
stb_arr_push(stu__pfunc.non_local_refs, j-n);
|
||||
// now make sure all the parents propogate it down
|
||||
// now make sure all the parents propagate it down
|
||||
for (k=n-1; k > 1; --k) {
|
||||
if (j-k >= 0) return j-n; // comes direct from this parent
|
||||
for(i=0; i < stb_arr_len(func_stack[k].non_local_refs); ++i)
|
||||
|
@ -190,7 +190,7 @@ static void stb__DitherBlock(unsigned char *dest, unsigned char *block)
|
||||
int err[8],*ep1 = err,*ep2 = err+4, *et;
|
||||
int ch,y;
|
||||
|
||||
// process channels seperately
|
||||
// process channels separately
|
||||
for (ch=0; ch<3; ++ch) {
|
||||
unsigned char *bp = block+ch, *dp = dest+ch;
|
||||
unsigned char *quant = (ch == 1) ? stb__QuantGTab+8 : stb__QuantRBTab+8;
|
||||
|
@ -5789,7 +5789,7 @@ static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req
|
||||
// Else if n is 128, noop.
|
||||
// Endloop
|
||||
|
||||
// The RLE-compressed data is preceeded by a 2-byte data count for each row in the data,
|
||||
// The RLE-compressed data is preceded by a 2-byte data count for each row in the data,
|
||||
// which we're going to just skip.
|
||||
stbi__skip(s, h * channelCount * 2 );
|
||||
|
||||
@ -6352,9 +6352,9 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i
|
||||
g->history = (stbi_uc *) stbi__malloc(g->w * g->h);
|
||||
if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory");
|
||||
|
||||
// image is treated as "tranparent" at the start - ie, nothing overwrites the current background;
|
||||
// image is treated as "transparent" at the start - ie, nothing overwrites the current background;
|
||||
// background colour is only used for pixels that are not rendered first frame, after that "background"
|
||||
// color refers to teh color that was there the previous frame.
|
||||
// color refers to the color that was there the previous frame.
|
||||
memset( g->out, 0x00, 4 * g->w * g->h );
|
||||
memset( g->background, 0x00, 4 * g->w * g->h ); // state of the background (starts transparent)
|
||||
memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame
|
||||
|
@ -668,7 +668,7 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(vsprintfcb)(STBSP_SPRINTFCB *callback,
|
||||
--pr; // when using %e, there is one digit before the decimal
|
||||
goto doexpfromg;
|
||||
}
|
||||
// this is the insane action to get the pr to match %g sematics for %f
|
||||
// this is the insane action to get the pr to match %g semantics for %f
|
||||
if (dp > 0) {
|
||||
pr = (dp < (stbsp__int32)l) ? l - dp : 0;
|
||||
} else {
|
||||
|
@ -688,7 +688,7 @@ static void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)
|
||||
static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
||||
{
|
||||
if (STB_TEXT_HAS_SELECTION(state)) {
|
||||
stb_textedit_delete_selection(str,state); // implicity clamps
|
||||
stb_textedit_delete_selection(str,state); // implicitly clamps
|
||||
state->has_preferred_x = 0;
|
||||
return 1;
|
||||
}
|
||||
@ -740,7 +740,7 @@ retry:
|
||||
state->has_preferred_x = 0;
|
||||
}
|
||||
} else {
|
||||
stb_textedit_delete_selection(str,state); // implicity clamps
|
||||
stb_textedit_delete_selection(str,state); // implicitly clamps
|
||||
if (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {
|
||||
stb_text_makeundo_insert(state, state->cursor, 1);
|
||||
++state->cursor;
|
||||
|
@ -251,7 +251,7 @@
|
||||
//
|
||||
// The following symbols set static limits which determine how much
|
||||
// memory will be allocated for the editor. You can override them
|
||||
// by making similiar definitions, but memory usage will increase.
|
||||
// by making similar definitions, but memory usage will increase.
|
||||
//
|
||||
// #define STBTE_MAX_TILEMAP_X 200 // max 4096
|
||||
// #define STBTE_MAX_TILEMAP_Y 200 // max 4096
|
||||
@ -2250,7 +2250,7 @@ enum
|
||||
STBTE__prop_int,
|
||||
};
|
||||
|
||||
// id is: [ 24-bit data : 7-bit identifer ]
|
||||
// id is: [ 24-bit data : 7-bit identifier ]
|
||||
// map id is: [ 12-bit y : 12 bit x : 7-bit identifier ]
|
||||
|
||||
#define STBTE__ID(n,p) ((n) + ((p)<<7))
|
||||
@ -2878,7 +2878,7 @@ static void stbte__drag_update(stbte_tilemap *tm, int mapx, int mapy, int copy_p
|
||||
stbte__set_link(tm, mapx, mapy, -1, -1, STBTE__undo_record);
|
||||
else if (moved || (copied && written)) {
|
||||
// if we move the target, we update to point to the new target;
|
||||
// or, if we copy the target and the source is part ofthe copy, then update to new target
|
||||
// or, if we copy the target and the source is part of the copy, then update to new target
|
||||
int x = k->x + (stbte__ui.drag_dest_x - stbte__ui.drag_x);
|
||||
int y = k->y + (stbte__ui.drag_dest_y - stbte__ui.drag_y);
|
||||
if (!(x >= 0 && y >= 0 && x < tm->max_x && y < tm->max_y))
|
||||
|
@ -75,7 +75,7 @@
|
||||
//
|
||||
// USAGE
|
||||
//
|
||||
// Include this file in whatever places neeed to refer to it. In ONE C/C++
|
||||
// Include this file in whatever places need to refer to it. In ONE C/C++
|
||||
// file, write:
|
||||
// #define STB_TRUETYPE_IMPLEMENTATION
|
||||
// before the #include of this file. This expands out the actual
|
||||
@ -247,8 +247,8 @@
|
||||
// Documentation & header file 520 LOC \___ 660 LOC documentation
|
||||
// Sample code 140 LOC /
|
||||
// Truetype parsing 620 LOC ---- 620 LOC TrueType
|
||||
// Software rasterization 240 LOC \ .
|
||||
// Curve tesselation 120 LOC \__ 550 LOC Bitmap creation
|
||||
// Software rasterization 240 LOC \
|
||||
// Curve tessellation 120 LOC \__ 550 LOC Bitmap creation
|
||||
// Bitmap management 100 LOC /
|
||||
// Baked bitmap interface 70 LOC /
|
||||
// Font name matching & access 150 LOC ---- 150
|
||||
@ -696,7 +696,7 @@ STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index);
|
||||
// file will only define one font and it always be at offset 0, so it will
|
||||
// return '0' for index 0, and -1 for all other indices.
|
||||
|
||||
// The following structure is defined publically so you can declare one on
|
||||
// The following structure is defined publicly so you can declare one on
|
||||
// the stack or as a global or etc, but you should treat it as opaque.
|
||||
struct stbtt_fontinfo
|
||||
{
|
||||
@ -822,7 +822,7 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s
|
||||
// returns # of vertices and fills *vertices with the pointer to them
|
||||
// these are expressed in "unscaled" coordinates
|
||||
//
|
||||
// The shape is a series of countours. Each one starts with
|
||||
// The shape is a series of contours. Each one starts with
|
||||
// a STBTT_moveto, then consists of a series of mixed
|
||||
// STBTT_lineto and STBTT_curveto segments. A lineto
|
||||
// draws a line from previous endpoint to its x,y; a curveto
|
||||
@ -918,7 +918,7 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
|
||||
STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff);
|
||||
// These functions compute a discretized SDF field for a single character, suitable for storing
|
||||
// in a single-channel texture, sampling with bilinear filtering, and testing against
|
||||
// larger than some threshhold to produce scalable fonts.
|
||||
// larger than some threshold to produce scalable fonts.
|
||||
// info -- the font
|
||||
// scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap
|
||||
// glyph/codepoint -- the character to generate the SDF for
|
||||
@ -3237,7 +3237,7 @@ static void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n)
|
||||
|
||||
static void stbtt__sort_edges_quicksort(stbtt__edge *p, int n)
|
||||
{
|
||||
/* threshhold for transitioning to insertion sort */
|
||||
/* threshold for transitioning to insertion sort */
|
||||
while (n > 12) {
|
||||
stbtt__edge t;
|
||||
int c01,c12,c,m,i,j;
|
||||
@ -3372,7 +3372,7 @@ static void stbtt__add_point(stbtt__point *points, int n, float x, float y)
|
||||
points[n].y = y;
|
||||
}
|
||||
|
||||
// tesselate until threshhold p is happy... @TODO warped to compensate for non-linear stretching
|
||||
// tessellate until threshold p is happy... @TODO warped to compensate for non-linear stretching
|
||||
static int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)
|
||||
{
|
||||
// midpoint
|
||||
|
@ -253,7 +253,7 @@ extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close,
|
||||
// create an ogg vorbis decoder from an open FILE *, looking for a stream at
|
||||
// the _current_ seek point (ftell). on failure, returns NULL and sets *error.
|
||||
// note that stb_vorbis must "own" this stream; if you seek it in between
|
||||
// calls to stb_vorbis, it will become confused. Morever, if you attempt to
|
||||
// calls to stb_vorbis, it will become confused. Moreover, if you attempt to
|
||||
// perform stb_vorbis_seek_*() operations on this file, it will assume it
|
||||
// owns the _entire_ rest of the file after the start point. Use the next
|
||||
// function, stb_vorbis_open_file_section(), to limit it.
|
||||
@ -1073,7 +1073,7 @@ static int compute_codewords(Codebook *c, uint8 *len, int n, uint32 *values)
|
||||
assert(z >= 0 && z < 32);
|
||||
available[z] = 0;
|
||||
add_entry(c, bit_reverse(res), i, m++, len[i], values);
|
||||
// propogate availability up the tree
|
||||
// propagate availability up the tree
|
||||
if (z != len[i]) {
|
||||
assert(len[i] >= 0 && len[i] < 32);
|
||||
for (y=len[i]; y > z; --y) {
|
||||
@ -2637,7 +2637,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
|
||||
// once I combined the passes.
|
||||
|
||||
// so there's a missing 'times 2' here (for adding X to itself).
|
||||
// this propogates through linearly to the end, where the numbers
|
||||
// this propagates through linearly to the end, where the numbers
|
||||
// are 1/2 too small, and need to be compensated for.
|
||||
|
||||
{
|
||||
@ -4566,7 +4566,7 @@ static int get_seek_page_info(stb_vorbis *f, ProbedPage *z)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// rarely used function to seek back to the preceeding page while finding the
|
||||
// rarely used function to seek back to the preceding page while finding the
|
||||
// start of a packet
|
||||
static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset)
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ extern "C" {
|
||||
// NOT IMPLEMENTED! Define HLSL shaders instead of GLSL shaders
|
||||
//
|
||||
// STBVOX_CONFIG_PREFER_TEXBUFFER
|
||||
// Stores many of the uniform arrays in texture buffers intead,
|
||||
// Stores many of the uniform arrays in texture buffers instead,
|
||||
// so they can be larger and may be more efficient on some hardware.
|
||||
//
|
||||
// STBVOX_CONFIG_LIGHTING_SIMPLE
|
||||
@ -1066,7 +1066,7 @@ enum
|
||||
// split into two triangles, each with their own normal/lighting.
|
||||
// (Note that since all output from stb_voxel_render is quad meshes,
|
||||
// triangles are actually rendered as degenerate quads.) In this case,
|
||||
// the distinction betwen STBVOX_GEOM_floor_vheight_03 and
|
||||
// the distinction between STBVOX_GEOM_floor_vheight_03 and
|
||||
// STBVOX_GEOM_floor_vheight_12 comes into play; the former introduces
|
||||
// an edge from the SW to NE corner (i.e. from <0,0,?> to <1,1,?>),
|
||||
// while the latter introduces an edge from the NW to SE corner
|
||||
|
@ -1250,13 +1250,13 @@ typedef struct
|
||||
// (internal) change the allocated length of the array
|
||||
#define stb_arr__grow(a,n) (stb_arr_check(a), stb_arrhead(a)->len += (n))
|
||||
|
||||
// add N new unitialized elements to the end of the array
|
||||
// add N new uninitialized elements to the end of the array
|
||||
#define stb_arr__addn(a,n) /*lint --e(826)*/ \
|
||||
((stb_arr_len(a)+(n) > stb_arrcurmax(a)) \
|
||||
? (stb__arr_addlen((void **) &(a),sizeof(*a),(n)),0) \
|
||||
: ((stb_arr__grow(a,n), 0)))
|
||||
|
||||
// add N new unitialized elements to the end of the array, and return
|
||||
// add N new uninitialized elements to the end of the array, and return
|
||||
// a pointer to the first new one
|
||||
#define stb_arr_addn(a,n) (stb_arr__addn((a),n),(a)+stb_arr_len(a)-(n))
|
||||
|
||||
|
@ -1492,7 +1492,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// the hardcoded compressed lengths being verified _could_
|
||||
// change if you changed the compresser parameters; but pure
|
||||
// change if you changed the compressor parameters; but pure
|
||||
// performance optimizations shouldn't change them
|
||||
p = stb_file("data/cantrbry.zip", &len2);
|
||||
if (p) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
// the cluster. Repeat for trimmed & special-trimmed. In the first case, find
|
||||
// previous instances of the cluster (allow don't-care to match in either
|
||||
// direction), both aligned and mis-aligned; in the latter, starting where
|
||||
// things start or mis-aligned. Build an index table specifiying the
|
||||
// things start or mis-aligned. Build an index table specifying the
|
||||
// location of each cluster (and its length). Allow an extra indirection here;
|
||||
// the full-sized index can index a smaller table which has the actual offset
|
||||
// (and lengths).
|
||||
|
Loading…
Reference in New Issue
Block a user