| 
						
						
						
					 | 
					 | 
					@ -1,4 +1,4 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// stb_rect_pack.h - v0.06 - public domain - rectangle packing
 | 
					 | 
					 | 
					 | 
					// stb_rect_pack.h - v0.07 - public domain - rectangle packing
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// Sean Barrett 2014
 | 
					 | 
					 | 
					 | 
					// Sean Barrett 2014
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// Useful for e.g. packing rectangular textures into an atlas.
 | 
					 | 
					 | 
					 | 
					// Useful for e.g. packing rectangular textures into an atlas.
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -28,10 +28,11 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//  Minor features
 | 
					 | 
					 | 
					 | 
					//  Minor features
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//    Martins Mozeiko
 | 
					 | 
					 | 
					 | 
					//    Martins Mozeiko
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//  Bugfixes / warning fixes
 | 
					 | 
					 | 
					 | 
					//  Bugfixes / warning fixes
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//    [your name could be here]
 | 
					 | 
					 | 
					 | 
					//    Jeremy Jaussaud
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// Version history:
 | 
					 | 
					 | 
					 | 
					// Version history:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					//     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.06  (2015-04-15)  added STBRP_SORT to allow replacing qsort
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//     0.05:  added STBRP_ASSERT to allow replacing assert
 | 
					 | 
					 | 
					 | 
					//     0.05:  added STBRP_ASSERT to allow replacing assert
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//     0.04:  fixed minor bug in STBRP_LARGE_RECTS support
 | 
					 | 
					 | 
					 | 
					//     0.04:  fixed minor bug in STBRP_LARGE_RECTS support
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -548,6 +549,10 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   for (i=0; i < num_rects; ++i) { | 
					 | 
					 | 
					 | 
					   for (i=0; i < num_rects; ++i) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); | 
					 | 
					 | 
					 | 
					      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 { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					         if (fr.prev_link) { | 
					 | 
					 | 
					 | 
					         if (fr.prev_link) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rects[i].x = (stbrp_coord) fr.x; | 
					 | 
					 | 
					 | 
					            rects[i].x = (stbrp_coord) fr.x; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rects[i].y = (stbrp_coord) fr.y; | 
					 | 
					 | 
					 | 
					            rects[i].y = (stbrp_coord) fr.y; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -555,6 +560,7 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            rects[i].x = rects[i].y = STBRP__MAXVAL; | 
					 | 
					 | 
					 | 
					            rects[i].x = rects[i].y = STBRP__MAXVAL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					         } | 
					 | 
					 | 
					 | 
					         } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					   } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   // unsort
 | 
					 | 
					 | 
					 | 
					   // unsort
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); | 
					 | 
					 | 
					 | 
					   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |