Grow by a factor of 2
		
	This reduces the amount of growing necessary for large glyphs
This commit is contained in:
		
					parent
					
						
							
								b15437b87f
							
						
					
				
			
			
				commit
				
					
						ca5f82e5e9
					
				
			
		
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -131,8 +131,10 @@ impl InnerAtlas {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO: Better resizing logic (?)
 | 
					        // Grow each dimension by a factor of 2. The growth factor was chosen to match the growth
 | 
				
			||||||
        let new_size = (self.size + Self::INITIAL_SIZE).min(self.max_texture_dimension_2d);
 | 
					        // factor of `Vec`.`
 | 
				
			||||||
 | 
					        const GROWTH_FACTOR: u32 = 2;
 | 
				
			||||||
 | 
					        let new_size = (self.size * GROWTH_FACTOR).min(self.max_texture_dimension_2d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.packer.grow(size2(new_size as i32, new_size as i32));
 | 
					        self.packer.grow(size2(new_size as i32, new_size as i32));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue