mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
Painter: Fix off-by-one in bounding rects for right-aligned text
Another instance of "Rect::right() is the last pixel *inside* the rect, not the first pixel outside the rect" messing me up.
This commit is contained in:
parent
a720061423
commit
d31ddf9aaa
Notes:
sideshowbarker
2024-07-19 12:47:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d31ddf9aaa8
@ -653,7 +653,7 @@ void Painter::draw_text(const Rect& rect, const StringView& text, const Font& fo
|
||||
} else if (alignment == TextAlignment::CenterLeft) {
|
||||
bounding_rect.set_location({ rect.x(), rect.center().y() - (bounding_rect.height() / 2) });
|
||||
} else if (alignment == TextAlignment::CenterRight) {
|
||||
bounding_rect.set_location({ rect.right() - bounding_rect.width(), rect.center().y() - (bounding_rect.height() / 2) });
|
||||
bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), rect.center().y() - (bounding_rect.height() / 2) });
|
||||
} else if (alignment == TextAlignment::Center) {
|
||||
bounding_rect.center_within(rect);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user