Render different variants according to subpixel positioning

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-03-24 18:20:25 +01:00
parent 9178e91cc0
commit bc977fc873
6 changed files with 69 additions and 40 deletions

View file

@ -272,14 +272,14 @@ impl Renderer {
glyph.font_id,
glyph.font_size,
glyph.id,
glyph.origin.x(),
scene.scale_factor(),
) {
sprites_by_atlas
.entry(sprite.atlas_id)
.or_insert_with(Vec::new)
.push(shaders::GPUISprite {
origin: (glyph.origin * scene.scale_factor() + sprite.offset.to_f32())
.to_float2(),
origin: (glyph.origin * scene.scale_factor() + sprite.offset).to_float2(),
size: sprite.size.to_float2(),
atlas_origin: sprite.atlas_origin.to_float2(),
color: glyph.color.to_uchar4(),