View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0038318||Lazarus||Packages||public||2021-01-05 22:00||2021-01-06 16:24|
|Priority||normal||Severity||minor||Reproducibility||have not tried|
|Product Version||2.1 (SVN)|
|Summary||0038318: TipHtmlPanel tweak for faster drawing|
|Description||About 3x faster page drawing - in procedure TIpNodeBlockLayouter.DoRenderElemWord()|
FCanvas.TextRect(R, P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord), TextStyle);
if aCurWord.AnsiWord = ' ' then
P.X := P.X + 1;
TextStyle.Clipping := False;
FCanvas.TextStyle := TextStyle;
FCanvas.TextOut(P.x, P.y, NoBreakToSpace(aCurWord.AnsiWord))
Some magic with space char need because calculated text length mismath, and space chars hides last pixels of words.
|Additional Information||Every text on page splitted to words and spaces. And every word and space measured, positioned and displayed separately. More words visible - more time need to draw them.|
Test project with patched files attached, click "Refresh" to measure paint speed. Checkboxes allow swith between default and new behavior.
|Tags||No tags attached.|
|Fixed in Revision|
ipro_test.zip (274,451 bytes)
Thanks. I played a bit with the patch and noticed that, since TextOut ignores TextStyle, all TextStyle-related assignments can be removed.
Store/RestoreCanvasProperties should not be dropped: In the demo html text change the line after "<h2>Description</h2>" to
"<p style="background-color:red;"><var>Name</var> is the name of the component..."
Run. Select part of the red text. Scroll down --> Text after the selection becomes white when the RestoreWordStyle box is not selected in your demo.
Can you point me to a location in the demo output to see why "P.X := P.X + 1" is needed for the space character?
> Can you point me to a location in the demo output to see why "P.X := P.X + 1" is needed for the space character?
Note word "Name" after "Description" header. Last pixels got cut off by space character.
||There is a problem with selected text: Check "UseTextOut" and drag the mouse over some text. While most of the text has the background in the corresponding color there are some lines left after some words. In the attached screenshot see the vertical lines before "name" and before "character". The lines disappear when a repaint is enforced, for example by scrolling or pressing the "Refresh" button.|
||Question: what about Right-to-Left text? The TIpHtmlPanel currently doesn't support it (though at least the dir attribute is parsed already), but using TextStyle would be one possibility to achive it and as wp said, TextOut ignores TextStyle.|
||Good point! I'm in doubt about this issue, too. Factor 3 sounds dramatic (it's only a factor 2 for me, still...), but playing with serbod's demo I don't notice any difference at user level. Are we sure that there is an attempt to paint any text outside the visible window? If out-of-view text is clipped I think we can ignore this optimization in favour of more flexibility for other issues.|
|2021-01-05 22:00||serbod||New Issue|
|2021-01-05 22:00||serbod||File Added: ipro_test.zip|
|2021-01-05 22:54||wp||Note Added: 0128106|
|2021-01-05 22:54||wp||Assigned To||=> wp|
|2021-01-05 22:54||wp||Status||new => assigned|
|2021-01-05 22:54||wp||Status||assigned => feedback|
|2021-01-05 22:54||wp||LazTarget||=> -|
|2021-01-05 22:57||wp||Note Edited: 0128106||View Revisions|
|2021-01-06 00:36||serbod||Note Added: 0128116|
|2021-01-06 00:36||serbod||Status||feedback => assigned|
|2021-01-06 12:58||wp||Note Added: 0128122|
|2021-01-06 12:58||wp||File Added: 38318.png|
|2021-01-06 14:37||Sven Barth||Note Added: 0128125|
|2021-01-06 16:24||wp||Note Added: 0128127|