Thomas Weidenmueller wrote:
Reduce memory usage of the syslink control and fix dependent code.
Alexandre has already said what he doesn't like about the patch, but I'll be a bit more specific. Put the below changes into a separate patch plus the moving around of the LIF_STATE case in SYSLINK_SetItem, because they are really separate changes.
@@ -878,7 +879,7 @@ if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus) { COLORREF PrevColor;
PrevColor = SetBkColor(hdc, OldBkColor);
PrevColor = SetTextColor(hdc, OldBkColor); DrawFocusRect(hdc, &bl->rc); SetBkColor(hdc, PrevColor); }
@@ -972,8 +973,7 @@ /* clear the document */ SYSLINK_ClearDoc(infoPtr);
- textlen = lstrlenW(Text);
- if(Text == NULL || textlen == 0)
- if(Text == NULL || (textlen = lstrlenW(Text)) == 0) { return TRUE; }
@@ -984,8 +984,9 @@ /* Render text position and word wrapping in memory */ HDC hdc = GetDC(infoPtr->Self); SYSLINK_Render(infoPtr, hdc);
SYSLINK_Draw(infoPtr, hdc); ReleaseDC(infoPtr->Self, hdc);
InvalidateRect(infoPtr->Self, NULL, TRUE);
}
return TRUE;
@@ -1531,11 +1553,8 @@ case WM_SIZE: { HDC hdc = GetDC(infoPtr->Self);
if(hdc != NULL)
{
SYSLINK_Render(infoPtr, hdc);
ReleaseDC(infoPtr->Self, hdc);
}
SYSLINK_Render(infoPtr, hdc);
}ReleaseDC(infoPtr->Self, hdc); return 0;