procedure SaveState;
begin
if DCIndex <> 0 then exit;
DCIndex := SaveDC(DC);
end;
The above procedure can be found nested inside procedure
TWin32ThemeServices.DrawText, function
TCanvas.TextExtent and procedure
TCanvas.TextRect. Before calling
SaveState each time
DCIndex is set to
0 which makes the line "
if DCIndex <> 0 then exit;" useless.
The following patch removes the line from all three nested procedures.