View Issue Details

IDProjectCategoryView StatusLast Update
0038318LazarusPackagespublic2021-01-06 16:24
Reporterserbod Assigned Towp  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Product Version2.1 (SVN) 
Summary0038318: TipHtmlPanel tweak for faster drawing
DescriptionAbout 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 InformationEvery 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.
TagsNo tags attached.
Fixed in Revision
Attached Files



2021-01-05 22:00

reporter (274,451 bytes)


2021-01-05 22:54

developer   ~0128106

Last edited: 2021-01-05 22:57

View 2 revisions

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?


2021-01-06 00:36

reporter   ~0128116

> 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.


2021-01-06 12:58

developer   ~0128122

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.
38318.png (6,993 bytes)   
38318.png (6,993 bytes)   

Sven Barth

2021-01-06 14:37

manager   ~0128125

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.


2021-01-06 16:24

developer   ~0128127

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.

Issue History

Date Modified Username Field Change
2021-01-05 22:00 serbod New Issue
2021-01-05 22:00 serbod File Added:
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