mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	Workaround a bug in BlurHashSharp
This commit is contained in:
		
							parent
							
								
									edcfcadcd3
								
							
						
					
					
						commit
						f30b07130f
					
				| @ -251,10 +251,18 @@ namespace Jellyfin.Drawing.Skia | |||||||
|             // We want tiles to be as close to square as possible, and to *mostly* keep under 16 tiles for performance. |             // We want tiles to be as close to square as possible, and to *mostly* keep under 16 tiles for performance. | ||||||
|             // One tile is (width / xComp) x (height / yComp) pixels, which means that ideally yComp = xComp * height / width. |             // One tile is (width / xComp) x (height / yComp) pixels, which means that ideally yComp = xComp * height / width. | ||||||
|             // See more at https://github.com/woltapp/blurhash/#how-do-i-pick-the-number-of-x-and-y-components |             // See more at https://github.com/woltapp/blurhash/#how-do-i-pick-the-number-of-x-and-y-components | ||||||
|             float xComp = MathF.Sqrt(16.0f * dims.Width / dims.Height); |             float xCompF = MathF.Sqrt(16.0f * dims.Width / dims.Height); | ||||||
|             float yComp = xComp * dims.Height / dims.Width; |             float yCompF = xCompF * dims.Height / dims.Width; | ||||||
| 
 | 
 | ||||||
|             return BlurHashEncoder.Encode(Math.Min((int)xComp + 1, 9), Math.Min((int)yComp + 1, 9), path); |             int xComp = Math.Min((int)xCompF + 1, 9); | ||||||
|  |             int yComp = Math.Min((int)yCompF + 1, 9); | ||||||
|  | 
 | ||||||
|  |             // FIXME: current lib is bugged for xComp != yComp | ||||||
|  |             // remove when https://github.com/Bond-009/BlurHashSharp/pull/1 is merged | ||||||
|  |             int tmp = Math.Max(xComp, yComp); | ||||||
|  |             xComp = yComp = tmp; | ||||||
|  | 
 | ||||||
|  |             return BlurHashEncoder.Encode(xComp, yComp, path); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private static bool HasDiacritics(string text) |         private static bool HasDiacritics(string text) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user