1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 06:42:12 +03:00

simplify glyph scaling computation

This commit is contained in:
Wez Furlong 2019-10-26 13:06:52 -07:00
parent 702fff7ab7
commit 9189014fc9

View File

@ -140,19 +140,13 @@ impl<T: Texture2d> GlyphCache<T> {
} else {
1.0f64
};
let (x_offset, y_offset) = if scale != 1.0 {
(info.x_offset * scale, info.y_offset * scale)
} else {
(info.x_offset, info.y_offset)
};
let glyph = if glyph.width == 0 || glyph.height == 0 {
// a whitespace glyph
CachedGlyph {
has_color,
texture: None,
x_offset,
y_offset,
x_offset: info.x_offset * scale,
y_offset: info.y_offset * scale,
bearing_x: 0.0,
bearing_y: 0.0,
scale,
@ -176,6 +170,8 @@ impl<T: Texture2d> GlyphCache<T> {
let bearing_x = glyph.bearing_x * scale;
let bearing_y = glyph.bearing_y * scale;
let x_offset = info.x_offset * scale;
let y_offset = info.y_offset * scale;
let (scale, raw_im) = if scale != 1.0 {
(1.0, raw_im.scale_by(scale))