lcl: simplify DrawText for empty strings (maybe fixes mantis #0025458)

git-svn-id: trunk@43648 -
This commit is contained in:
paul 2014-01-05 11:16:30 +00:00
parent 3b8a0d9df1
commit 39872a9b0a

View File

@ -361,7 +361,6 @@ var
I : Integer;
Lines : TStrings;
TDC : hDC;
pStr : PChar;
tmpString,
AStr : String;
pIndex,
@ -626,7 +625,8 @@ var
OffsetRect(theRect, 0, Rect.Bottom - theRect.Bottom);
end;
end;
var
pStr: PChar;
begin
Result := 0;
Lines := nil;
@ -636,13 +636,21 @@ begin
Count := StrLen(Str);
{Calculate # Lines, etc.}
if Count > 0 then
begin
pStr := StrAlloc(Count + 1);
try
StrLCopy(pStr, Str, Count);
pStr[Count] := #0;
AStr := String(pStr);
finally
StrDispose(pStr);
end;
end
else
AStr := '';
tmpString := Copy(AStr, 1, Length(ASTR));
tmpString := Copy(AStr, 1, Length(AStr));
{Get font & string metrics}
GetTextMetrics(DC, TM);
@ -661,9 +669,6 @@ begin
{Break string into individual lines}
MaxLength := (Rect.Right - Rect.Left);
Lines := DoBreakString(AStr);
finally
StrDispose(pStr);
end;
{Error occcured...}
If Lines = nil then