mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Snap icon sprites to pixel grid
This should resolve some rendering artifacts potentially caused by floating point errors when sampling the texture. It should also lead to crisper images when icons are rendered midway through a pixel.
This commit is contained in:
parent
3ae5fc74c9
commit
f69bd0e327
1 changed files with 4 additions and 3 deletions
|
@ -561,9 +561,10 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
for icon in icons {
|
for icon in icons {
|
||||||
let origin = icon.bounds.origin() * scale_factor;
|
// Snap sprite to pixel grid.
|
||||||
let target_size = icon.bounds.size() * scale_factor;
|
let origin = (icon.bounds.origin() * scale_factor).floor();
|
||||||
let source_size = (target_size * 2.).ceil().to_i32();
|
let target_size = (icon.bounds.size() * scale_factor).ceil();
|
||||||
|
let source_size = (target_size * 2.).to_i32();
|
||||||
|
|
||||||
let sprite =
|
let sprite =
|
||||||
self.sprite_cache
|
self.sprite_cache
|
||||||
|
|
Loading…
Reference in a new issue