1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:17:35 +00:00

LibGfx: Intersect the bounding box with the main rect in draw_text

Without this, the bounding rect for the text as generated by TextLayout
can go beyond the bounds of the user-supplied drawing rect and cause the
text to overlap because of the line_rect.intersect(rect) a few lines
below.
This commit is contained in:
sin-ack 2021-08-31 19:18:53 +00:00 committed by Andreas Kling
parent ed6c1f53af
commit 1999b66f38

View file

@ -1471,6 +1471,8 @@ void Painter::do_draw_text(IntRect const& rect, Utf8View const& text, Font const
VERIFY_NOT_REACHED();
}
bounding_rect.intersect(rect);
for (size_t i = 0; i < lines.size(); ++i) {
auto line = Utf8View { lines[i] };