mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:08:12 +00:00
LibWeb: Pass FloatRect to Painter::draw_text in fill_text
Don't round float values to int values in CanvasRenderingContext2D::fill_text when passing them to Painter::draw_text. This also fixes a fixme.
This commit is contained in:
parent
93737a4b00
commit
fab8ef3dfc
1 changed files with 2 additions and 3 deletions
|
@ -204,11 +204,10 @@ void CanvasRenderingContext2D::fill_text(DeprecatedString const& text, float x,
|
|||
|
||||
auto& drawing_state = this->drawing_state();
|
||||
|
||||
// FIXME: painter only supports integer rects for text right now, so this effectively chops off any fractional position
|
||||
auto text_rect = Gfx::IntRect(x, y, max_width.has_value() ? static_cast<float>(max_width.value()) : painter->font().width(text), painter->font().pixel_size());
|
||||
auto text_rect = Gfx::FloatRect(x, y, max_width.has_value() ? static_cast<float>(max_width.value()) : painter->font().width(text), painter->font().pixel_size());
|
||||
auto transformed_rect = drawing_state.transform.map(text_rect);
|
||||
painter->draw_text(transformed_rect, text, Gfx::TextAlignment::TopLeft, drawing_state.fill_style);
|
||||
did_draw(transformed_rect.to_type<float>());
|
||||
did_draw(transformed_rect);
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::stroke_text(DeprecatedString const& text, float x, float y, Optional<double> max_width)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue