Make ui::edit clip renderered text by text box using stencil
This commit is contained in:
parent
5066dd6494
commit
c06a465f51
1 changed files with 6 additions and 0 deletions
|
|
@ -309,6 +309,10 @@ namespace psemek::ui
|
|||
break;
|
||||
}
|
||||
|
||||
p.begin_stencil();
|
||||
p.draw_rect(text_box_, {0, 0, 0, 255});
|
||||
p.commit_stencil();
|
||||
|
||||
if (*st->text_shadow_offset != geom::vector{0, 0} && (*st->shadow_color)[3] != 0)
|
||||
{
|
||||
auto shoffset = offset + geom::cast<float>(*st->text_shadow_offset);
|
||||
|
|
@ -319,6 +323,8 @@ namespace psemek::ui
|
|||
for (auto const & g : cached_state_->glyphs)
|
||||
p.draw_glyph(*cached_state_->font, g.character, g.position + offset, *st->text_color);
|
||||
|
||||
p.end_stencil();
|
||||
|
||||
if (caret_visible_)
|
||||
{
|
||||
float x;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue