Skip to content

Commit 6b7103d

Browse files
author
livecodeali
committed
[[ Bug 17117 ]] Set clip rect to content rect before drawing icon
1 parent 5c25307 commit 6b7103d

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

docs/notes/bugfix-17117.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Clip content correctly when control selected

engine/src/buttondraw.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,13 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
443443
sy = centery - (nlines * fheight / 2) + fleading/2 + fascent;
444444
theight = nlines * fheight;
445445
}
446+
447+
coord_t starty = sy;
448+
uint2 i;
449+
coord_t twidth = 0;
450+
451+
dc->save();
452+
dc->cliprect(t_content_rect);
446453

447454
// MW-2014-06-19: [[ IconGravity ]] Use old method of calculating icon location if gravity is none.
448455
if (flags & F_SHOW_ICON && icons != NULL && icons->curicon != NULL && m_icon_gravity == kMCGravityNone)
@@ -470,13 +477,6 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
470477
icons->curicon->drawcentered(dc, centerx + loff, centery + loff, (state & CS_HILITED) != 0);
471478
icondrawed = True;
472479
}
473-
474-
coord_t starty = sy;
475-
uint2 i;
476-
coord_t twidth = 0;
477-
478-
dc->save();
479-
dc->cliprect(t_content_rect);
480480

481481
uindex_t t_totallen = 0;
482482
for (i = 0 ; i < nlines ; i++)

0 commit comments

Comments
 (0)