Fix off-by-ones with bottom and right aligned positioning

wxDC::DrawLabel() positions the text one to the left with wxALIGN_RIGHT
alignment and one up with wxALIGN_BOTTOM alignment. The same occurs in
wxControlRenderer::DrawBitmap() for bitmaps. Both off-by-ones exist
since inception in respectively 4d3c4c2f94 and bc60c3d699.

This fix vertically aligns wxALIGN_BOTTOM drawing of wxDC::DrawLabel()
with themed text drawing through wxRendererXP::DrawItemText().
This commit is contained in:
Dimitri Schoolwerth
2021-02-13 13:09:18 +01:00
parent b8af267bf9
commit d83d126959
2 changed files with 4 additions and 4 deletions

View File

@@ -1196,7 +1196,7 @@ void wxDC::DrawLabel(const wxString& text,
wxCoord x, y;
if ( alignment & wxALIGN_RIGHT )
{
x = rect.GetRight() - width;
x = rect.GetRight() - width + 1;
}
else if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
{
@@ -1209,7 +1209,7 @@ void wxDC::DrawLabel(const wxString& text,
if ( alignment & wxALIGN_BOTTOM )
{
y = rect.GetBottom() - height;
y = rect.GetBottom() - height + 1;
}
else if ( alignment & wxALIGN_CENTRE_VERTICAL )
{

View File

@@ -185,7 +185,7 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
{
if ( alignment & wxALIGN_RIGHT )
{
x = rect.GetRight() - width;
x = rect.GetRight() - width + 1;
}
else if ( alignment & wxALIGN_CENTRE )
{
@@ -198,7 +198,7 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
if ( alignment & wxALIGN_BOTTOM )
{
y = rect.GetBottom() - height;
y = rect.GetBottom() - height + 1;
}
else if ( alignment & wxALIGN_CENTRE_VERTICAL )
{