add round to avoid precision problem
This commit is contained in:
		
							parent
							
								
									f016281e30
								
							
						
					
					
						commit
						3899e4e12e
					
				| @ -38,7 +38,7 @@ impl Display { | |||||||
|         let w = unsafe { CGDisplayPixelsWide(self.0) }; |         let w = unsafe { CGDisplayPixelsWide(self.0) }; | ||||||
|         let s = self.scale(); |         let s = self.scale(); | ||||||
|         if s > 1.0 { |         if s > 1.0 { | ||||||
|            ((w as f64) * s) as usize |            ((w as f64) * s).round() as usize | ||||||
|         } else { |         } else { | ||||||
|             w |             w | ||||||
|         } |         } | ||||||
| @ -48,7 +48,7 @@ impl Display { | |||||||
|         let h = unsafe { CGDisplayPixelsHigh(self.0) }; |         let h = unsafe { CGDisplayPixelsHigh(self.0) }; | ||||||
|         let s = self.scale(); |         let s = self.scale(); | ||||||
|         if s > 1.0 { |         if s > 1.0 { | ||||||
|            ((h as f64) * s) as usize |            ((h as f64) * s).round() as usize | ||||||
|         } else { |         } else { | ||||||
|             h |             h | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user