High performance text component
a.thieme at freenet.de
Sun Aug 5 07:17:29 PDT 2012
Am 03.08.2012 05:19, schrieb Joseph Andresen:
> Hey Andre!
> This sounds pretty exciting!
> There are many mechanisms in place for drawing text efficiently.
> I would encourage you to concentrate on what text is on the screen at
> any given moment. If a list view has a million items and you can only
> see 10 at one time, it has virtual items that are filled as needed.
> I see your text editor being organized the same way. There are only a
> given amount of lines per "file view", and your task would be to
> manipulate the text on these lines. I am not so sure I would use
> canvas for this particular part of the problem.
Can you explain why you tend to use Text instances right now, instead of
Right now it seems to me that both approaches would require roughly the
same amount of bookkeeping code. I calculate the height of the CodePane
and set the scrollbars to the according size. When the scrolling gets
triggered I will have to calculate a new view into my model and update
the x/y coordinates of most Text instances, and change some (if a line
completly disappears and not even one pixel of the text would be visible
A Canvas would have to be painted again completly. But currently it was
pretty efficient: on my laptop hardware I painted 14k words on the
Canvas, with small font size, within about 30 msecs. And 50 msecs would
still be enough for 20 FPS ==> smooth enough scrolling.
More information about the openjfx-dev