Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 67b69c7

Browse files
author
Jonah Williams
authored
[Impeller] ensure fp rounding errors don't cause us to lose a row of pixels when computing text positions. (#54015)
Dividing then multipliying can lead to position values like 432.99987 which end up losing a pixel.
1 parent ceb452f commit 67b69c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

impeller/entity/contents/text_contents.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ bool TextContents::Render(const ContentContext& renderer,
254254
for (const Point& point : unit_points) {
255255
Point position;
256256
if (is_translation_scale) {
257-
position = screen_glyph_position +
258-
(basis_transform * point * scaled_bounds.GetSize());
257+
position = (screen_glyph_position +
258+
(basis_transform * point * scaled_bounds.GetSize()))
259+
.Round();
259260
} else {
260261
position = entity_transform * (glyph_position.position +
261262
scaled_bounds.GetLeftTop() +

0 commit comments

Comments
 (0)