mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	Everywhere: Don't promote float to double where not needed
The `float => double => float` round trip seen in a couple of places might pessimize the code. Even if it's truncated to an int in the end, it's weird not to use the functions with the `f` suffixes when working with single precision floats.
This commit is contained in:
		
							parent
							
								
									01a0aa6e0b
								
							
						
					
					
						commit
						f14a4994b0
					
				
					 6 changed files with 16 additions and 16 deletions
				
			
		|  | @ -420,8 +420,8 @@ RefPtr<Gfx::Bitmap> Bitmap::scaled(float sx, float sy) const | |||
|             auto p = static_cast<float>(x) * static_cast<float>(old_width - 1) / static_cast<float>(new_width - 1); | ||||
|             auto q = static_cast<float>(y) * static_cast<float>(old_height - 1) / static_cast<float>(new_height - 1); | ||||
| 
 | ||||
|             int i = floor(p); | ||||
|             int j = floor(q); | ||||
|             int i = floorf(p); | ||||
|             int j = floorf(q); | ||||
|             float u = p - static_cast<float>(i); | ||||
|             float v = q - static_cast<float>(j); | ||||
| 
 | ||||
|  | @ -443,7 +443,7 @@ RefPtr<Gfx::Bitmap> Bitmap::scaled(float sx, float sy) const | |||
|     for (int x = 0; x < new_width - 1; x++) { | ||||
|         auto p = static_cast<float>(x) * static_cast<float>(old_width - 1) / static_cast<float>(new_width - 1); | ||||
| 
 | ||||
|         int i = floor(p); | ||||
|         int i = floorf(p); | ||||
|         float u = p - static_cast<float>(i); | ||||
| 
 | ||||
|         auto a = get_pixel(i, old_bottom_y); | ||||
|  | @ -458,7 +458,7 @@ RefPtr<Gfx::Bitmap> Bitmap::scaled(float sx, float sy) const | |||
|     for (int y = 0; y < new_height - 1; y++) { | ||||
|         auto q = static_cast<float>(y) * static_cast<float>(old_height - 1) / static_cast<float>(new_height - 1); | ||||
| 
 | ||||
|         int j = floor(q); | ||||
|         int j = floorf(q); | ||||
|         float v = q - static_cast<float>(j); | ||||
| 
 | ||||
|         auto c = get_pixel(old_right_x, j); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Bertalan
						Daniel Bertalan