summaryrefslogtreecommitdiffhomepage
path: root/src/external/stb_rect_pack.h
diff options
context:
space:
mode:
authorRay <[email protected]>2017-02-07 09:40:06 +0100
committerGitHub <[email protected]>2017-02-07 09:40:06 +0100
commit94929011330b27f3d027975b52cf0d43ba85c38b (patch)
tree9ddff0e6ddba65004557c3628a3d56dfaf47ea4b /src/external/stb_rect_pack.h
parent17f09cb03484a408cdd50a3d2e4d6604bb1f4c70 (diff)
parent1f6eb1fc61d2cc0cca54a79c1516432f09c86313 (diff)
downloadraylib-94929011330b27f3d027975b52cf0d43ba85c38b.tar.gz
raylib-94929011330b27f3d027975b52cf0d43ba85c38b.zip
Merge pull request #223 from raysan5/develop
Integrate develop branch into master
Diffstat (limited to 'src/external/stb_rect_pack.h')
-rw-r--r--src/external/stb_rect_pack.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/external/stb_rect_pack.h b/src/external/stb_rect_pack.h
index bd1cfc60..c75527da 100644
--- a/src/external/stb_rect_pack.h
+++ b/src/external/stb_rect_pack.h
@@ -1,4 +1,4 @@
-// stb_rect_pack.h - v0.08 - public domain - rectangle packing
+// stb_rect_pack.h - v0.10 - public domain - rectangle packing
// Sean Barrett 2014
//
// Useful for e.g. packing rectangular textures into an atlas.
@@ -32,6 +32,8 @@
//
// Version history:
//
+// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
+// 0.09 (2016-08-27) fix compiler warnings
// 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
@@ -148,7 +150,7 @@ enum
{
STBRP_HEURISTIC_Skyline_default=0,
STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
- STBRP_HEURISTIC_Skyline_BF_sortHeight,
+ STBRP_HEURISTIC_Skyline_BF_sortHeight
};
@@ -198,9 +200,15 @@ struct stbrp_context
#define STBRP_ASSERT assert
#endif
+#ifdef _MSC_VER
+#define STBRP__NOTUSED(v) (void)(v)
+#else
+#define STBRP__NOTUSED(v) (void)sizeof(v)
+#endif
+
enum
{
- STBRP__INIT_skyline = 1,
+ STBRP__INIT_skyline = 1
};
STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
@@ -273,6 +281,9 @@ static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0
stbrp_node *node = first;
int x1 = x0 + width;
int min_y, visited_width, waste_area;
+
+ STBRP__NOTUSED(c);
+
STBRP_ASSERT(first->x <= x0);
#if 0
@@ -500,8 +511,8 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i
static int rect_height_compare(const void *a, const void *b)
{
- stbrp_rect *p = (stbrp_rect *) a;
- stbrp_rect *q = (stbrp_rect *) b;
+ const stbrp_rect *p = (const stbrp_rect *) a;
+ const stbrp_rect *q = (const stbrp_rect *) b;
if (p->h > q->h)
return -1;
if (p->h < q->h)
@@ -511,8 +522,8 @@ static int rect_height_compare(const void *a, const void *b)
static int rect_width_compare(const void *a, const void *b)
{
- stbrp_rect *p = (stbrp_rect *) a;
- stbrp_rect *q = (stbrp_rect *) b;
+ const stbrp_rect *p = (const stbrp_rect *) a;
+ const stbrp_rect *q = (const stbrp_rect *) b;
if (p->w > q->w)
return -1;
if (p->w < q->w)
@@ -522,8 +533,8 @@ static int rect_width_compare(const void *a, const void *b)
static int rect_original_order(const void *a, const void *b)
{
- stbrp_rect *p = (stbrp_rect *) a;
- stbrp_rect *q = (stbrp_rect *) b;
+ const stbrp_rect *p = (const stbrp_rect *) a;
+ const stbrp_rect *q = (const stbrp_rect *) b;
return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);
}