[Kstars-devel] Note on drawing speed

Luciano Montanaro mikelima at cirulla.net
Wed Mar 10 18:01:35 CET 2010


On Wed, Mar 10, 2010 at 4:22 PM, Khudyakov Alexey
<alexey.skladnoy at gmail.com> wrote:
> Hello
>
> It's well known that drawing of sky map in kstars is way too slow. Recently I
> identified one of bottlenecks. At low zoom about a half of time is spent in
> drawing constellation boundaries and coordinate grid. Almost all that time is
> spent in QPaint::drawLine and number of calls is very big.
>

It looks like there are further opportunities to optimize, but a first
step would be by
filling an array of coordinates and calling drawLines()  instead of
using a loop around
drawLine(). Maybe Qt does some coalescing, but there are expensive
operations that
are repeated for each drawLine() call that only need to be done once.

> I suspect that problem is that lines are divided in too many segments.
> I think best approach it to write generic function for drawing arcs on the
> sphere. Such function will use minimal number of line segments. Another
> possibility is to approximate arc on sphere with arc on plane.
>
> It's not clear how such function could be implemented. I didn't do all the mah
> yet.
>
> Also I must note that this approach has one clear advantage: it becomes
> reasonable easy possible to draw coordinate grid which step adapts to field of
> view.
>
> --
>  Khudyakov Alexey



-- 
Luciano Montanaro

Anyone who is capable of getting themselves made President should on
no account be allowed to do the job. -- Douglas Adams


More information about the Kstars-devel mailing list