[Impeller] ensure fp rounding errors don't cause us to lose a row of pixels when computing text positions. (flutter/engine#54015)

Dividing then multipliying can lead to position values like 432.99987 which end up losing a pixel.
This commit is contained in:
Jonah Williams 2024-07-22 12:03:04 -07:00 committed by GitHub
parent 08c7b8d6e2
commit bb010156f5

View File

@ -254,8 +254,9 @@ bool TextContents::Render(const ContentContext& renderer,
for (const Point& point : unit_points) {
Point position;
if (is_translation_scale) {
position = screen_glyph_position +
(basis_transform * point * scaled_bounds.GetSize());
position = (screen_glyph_position +
(basis_transform * point * scaled_bounds.GetSize()))
.Round();
} else {
position = entity_transform * (glyph_position.position +
scaled_bounds.GetLeftTop() +