Forum > QT

What I've found about slowdown of CudaText rendering (qt5 now)

(1/2) > >>

AlexTP:
https://github.com/Alexey-T/CudaText/issues/3089


--- Quote ---I found that scale of window by X (800x600 -> 1800x600) don't slow down the rendering.
scale of window by Y (800x600 -> 800x1200) DOES slow down (600->1200, slower by 2 times).
so the reason is: Canvas.TextOut (or LCLIntf.ExtTextOut) is slowing down all render.
I also see that debugger stops inside the ExtTextOut (most of the time, in 80%).

I cannot solve it, TextOut (ExtTextOut) on linux is not known code to me.

the same slowdown occurs on gtk2 and qt5.
so it is mostly Lazarus issue of gtk2/qt5 codes.
--- End quote ---

balazsszekely:
Hi Alextp,

Why don't you use DrawText from LCLIntf? It has a lot more options then Canvas.TextOut and it works well in every widgetset(see: VirtualTreeView, OPM, etc...).
Here is a quick example:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses LCLIntf, LCLType; procedure TForm1.FormPaint(Sender: TObject);var  Txt: String;  R: TRect;begin  Txt := 'Cudatext editor';  R := ClientRect;  Self.Canvas.Brush.Style := bsClear;  DrawText(Self.Canvas.Handle, PChar(Txt), Length(Txt), R, DT_SINGLELINE or DT_CENTER or DT_VCENTER);end;

440bx:

--- Quote from: GetMem on January 30, 2021, 10:04:05 am ---Why don't you use DrawText from LCLIntf? It has a lot more options then Canvas.TextOut and it works well in every widgetset(see: VirtualTreeView, OPM, etc...).

--- End quote ---
It's been a while since I tested DrawText's performance but, the last time I tested it (probably under XP), its performance was downright dismal.  In general, TextOut and ExtTextOut provide much better performance even when custom user code has to replicate some of the DrawText features.

AlexTP:

--- Quote ---  DrawText(Self.Canvas.Handle, PChar(Txt), Length(Txt), R, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
--- End quote ---

I need the Dx array of char offsets; DrawText isn't allowing it..

balazsszekely:
@440bx

--- Quote ---It's been a while since I tested DrawText's performance but, the last time I tested it (probably under XP), its performance was downright dismal.  In general, TextOut and ExtTextOut provide much better performance even when custom user code has to replicate some of the DrawText features.

--- End quote ---
Fair enough. I did not run any performance test myself, but according to the documentation, the speed depends on the text type. Drawing multiline text should be faster with DrawText(at least on windows). Please see this: https://docs.microsoft.com/en-us/windows/win32/gdi/drawing-text


@Alextp

--- Quote ---I need the Dx array of char offsets; DrawText isn't allowing it..
--- End quote ---
Can you please give an example where TextOut works and DrawText fails?

Navigation

[0] Message Index

[#] Next page

Go to full version