Use gfx::RectF instead of gfx::Rect for text line bounds

This commit is contained in:
David Capello 2025-10-07 09:32:53 -03:00
parent fb4f4d9fa6
commit 0dc4bc9aa7
2 changed files with 4 additions and 4 deletions

View File

@ -843,7 +843,7 @@ void TextEdit::Line::insertText(int pos, const std::string& str)
text.insert(utfSize[pos - 1].end, str);
}
gfx::Rect TextEdit::Line::getBounds(const int glyph) const
gfx::RectF TextEdit::Line::getBounds(const int glyph) const
{
int advance = 0;
gfx::Rect result;
@ -857,7 +857,7 @@ gfx::Rect TextEdit::Line::getBounds(const int glyph) const
return result;
}
gfx::Rect TextEdit::Line::getBounds(int startGlyph, int endGlyph) const
gfx::RectF TextEdit::Line::getBounds(const int startGlyph, const int endGlyph) const
{
if (startGlyph == endGlyph)
return {};

View File

@ -62,10 +62,10 @@ private:
// Insert text into this line based on a caret position, taking into account utf8 size.
void insertText(int pos, const std::string& str);
gfx::Rect getBounds(int glyph) const;
gfx::RectF getBounds(int glyph) const;
// Get the screen size between the start and end glyph positions.
gfx::Rect getBounds(int startGlyph, int endGlyph) const;
gfx::RectF getBounds(int startGlyph, int endGlyph) const;
};
struct Caret {