speed up drawing text window in UTF8 build (something like 40 times faster in debug)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -934,7 +934,9 @@ void MyAutoTimedScrollingWindow::OnDraw(wxDC& dc)
|
|||||||
wxBrush selBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)
|
wxBrush selBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)
|
||||||
, wxSOLID);
|
, wxSOLID);
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
wxString str = sm_testData;
|
const wxString str = sm_testData;
|
||||||
|
size_t strLength = str.length();
|
||||||
|
wxString::const_iterator str_i;
|
||||||
|
|
||||||
// draw the characters
|
// draw the characters
|
||||||
// 1. for each update region
|
// 1. for each update region
|
||||||
@@ -945,6 +947,7 @@ void MyAutoTimedScrollingWindow::OnDraw(wxDC& dc)
|
|||||||
for (int chY = updRectInGChars.y
|
for (int chY = updRectInGChars.y
|
||||||
; chY <= updRectInGChars.y + updRectInGChars.height; ++chY) {
|
; chY <= updRectInGChars.y + updRectInGChars.height; ++chY) {
|
||||||
// 3. for each character in the row
|
// 3. for each character in the row
|
||||||
|
bool isFirstX = true;
|
||||||
for (int chX = updRectInGChars.x
|
for (int chX = updRectInGChars.x
|
||||||
; chX <= updRectInGChars.x + updRectInGChars.width
|
; chX <= updRectInGChars.x + updRectInGChars.width
|
||||||
; ++chX) {
|
; ++chX) {
|
||||||
@@ -966,10 +969,15 @@ void MyAutoTimedScrollingWindow::OnDraw(wxDC& dc)
|
|||||||
size_t charIndex = chY * sm_lineLen + chX;
|
size_t charIndex = chY * sm_lineLen + chX;
|
||||||
if (chY < sm_lineCnt &&
|
if (chY < sm_lineCnt &&
|
||||||
chX < sm_lineLen &&
|
chX < sm_lineLen &&
|
||||||
charIndex < str.Length())
|
charIndex < strLength)
|
||||||
{
|
{
|
||||||
dc.DrawText(str.Mid(charIndex,1),
|
if (isFirstX)
|
||||||
charPos.x, charPos.y);
|
{
|
||||||
|
str_i = str.begin() + charIndex;
|
||||||
|
isFirstX = false;
|
||||||
|
}
|
||||||
|
dc.DrawText(*str_i, charPos.x, charPos.y);
|
||||||
|
++str_i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user