Minor simplification in generic wxCaret

Only create wxMemoryDC if it's actually needed.
This commit is contained in:
Paul Cornett
2022-03-27 13:54:46 -07:00
parent 03bf61be3c
commit 9af728caea

View File

@@ -243,13 +243,10 @@ void wxCaret::Refresh()
return; return;
} }
wxMemoryDC dcMem;
dcMem.SelectObject(m_bmpUnderCaret);
if ( m_blinkedOut ) if ( m_blinkedOut )
{ {
// restore the old image // restore the old image
dcWin.Blit(m_xOld, m_yOld, m_width, m_height, dcWin.DrawBitmap(m_bmpUnderCaret, m_xOld, m_yOld);
&dcMem, 0, 0);
m_xOld = m_xOld =
m_yOld = -1; m_yOld = -1;
} }
@@ -257,6 +254,7 @@ void wxCaret::Refresh()
{ {
if ( m_xOld == -1 && m_yOld == -1 ) if ( m_xOld == -1 && m_yOld == -1 )
{ {
wxMemoryDC dcMem(m_bmpUnderCaret);
// save the part we're going to overdraw // save the part we're going to overdraw
dcMem.Blit(0, 0, m_width, m_height, dcMem.Blit(0, 0, m_width, m_height,
&dcWin, m_x, m_y); &dcWin, m_x, m_y);