properly fix stb_rect_pack;

tweak formatting of FAQ list
This commit is contained in:
Sean Barrett 2015-09-13 16:07:49 -07:00
parent e847954d27
commit b74da797af
2 changed files with 5 additions and 6 deletions

View File

@ -32,6 +32,7 @@
//
// Version history:
//
// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
// 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0)
// 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
// 0.05: added STBRP_ASSERT to allow replacing assert
@ -548,11 +549,10 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);
for (i=0; i < num_rects; ++i) {
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
if (rects[i].w == 0 || rects[i].h == 0) {
rects[i].x = rects[i].y = 0; // empty rect needs no space
} else {
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
if (fr.prev_link) {
rects[i].x = (stbrp_coord) fr.x;
rects[i].y = (stbrp_coord) fr.y;

View File

@ -18,25 +18,24 @@ free to tell me about their quality.)
- [gif.h](https://github.com/ginsweater/gif-h): animated GIF writer (public domain)
- [tiny_jpeg.h](https://github.com/serge-rgb/TinyJPEG/blob/master/tiny_jpeg.h): JPEG encoder (public domain)
- [lodepng](http://lodev.org/lodepng/): PNG encoder/decoder (zlib license)
- [nanoSVG](https://github.com/memononen/nanosvg): 1-file SVG parser; 1-file SVG rasterizer (zlib license)
- [tinyobjloader](https://github.com/syoyo/tinyobjloader): wavefront OBJ file loader (BSD license)
- [sdf.h](https://github.com/memononen/SDF): compute signed-distance field from antialiased image (MIT license)
- [nv_voronoi.h](http://www.icculus.org/~mordred/nvlib/): find voronoi regions on lattice w/ integer inputs (public domain)
- [nanoflann](https://github.com/jlblancoc/nanoflann): build KD trees for point clouds (BSD license)
- [SLRE](https://github.com/cesanta/slre): regular expression matcher (GPL v2)
- [DG_misc.h](https://github.com/DanielGibson/Snippets/): Daniel Gibson's stb.h-esque cross-platform helpers: path/file, strings (public domain)
- [MakeID.h](http://www.humus.name/3D/MakeID.h): allocate/deallocate small integer IDs efficiently (public domain)
- [utest](https://github.com/evolutional/utest): unit testing (MIT license)
- [catch](https://github.com/philsquared/Catch): unit testing (Boost license)
- [pempek_assert.cpp](https://github.com/gpakosz/Assert/tree/master/src): C++ flexible assertions in C++ (WTFPL v2 license)
- [zed_net](https://github.com/ZedZull/zed_net): cross-platform socket wrapper (public domain)
There are some that have a source file and require a separate header file (which they may
not even supply). That's twice as many files, and we at nothings/stb cannot condone
this! But you might like them anyway:
- [pempek_assert.cpp](https://github.com/gpakosz/Assert/tree/master/src): C++ flexible assertions in C++ (WTFPL v2 license)
- [whereami](https://github.com/gpakosz/whereami): get path/filename of executable (WTFPL v2 license)
- [picopng.cpp](http://lodev.org/lodepng/picopng.cpp): tiny PNG loader (zlib license)
- [jpeg-compressor](https://github.com/richgel999/jpeg-compressor): 2-file jpeg compress, 2-file jpeg decompress (public domain)
- [lz4](https://github.com/Cyan4973/lz4): fast but larger LZ compression (BSD license)