[GRASS-dev] PNG driver - slow?

Hi,

export GRASS_PNGFILE=/tmp/pokus.png
export GRASS_RENDER_IMMEDIATE=TRUE

time d.vect map=soils@PERMANENT
real 0m0.197s
user 0m0.166s
sys 0m0.019s

time d.vect map=soils@PERMANENT color=yellow fcolor=yellow cats=32 width=3
real 0m13.767s
user 0m13.611s
sys 0m0.098s

Why is the second case so slow? Is it a bug in PNG driver? What can I
do, so it is rendered faster?

Thanks

Jachym

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Jachym Cepicky wrote:

export GRASS_PNGFILE=/tmp/pokus.png
export GRASS_RENDER_IMMEDIATE=TRUE

time d.vect map=soils@PERMANENT
real 0m0.197s
user 0m0.166s
sys 0m0.019s

time d.vect map=soils@PERMANENT color=yellow fcolor=yellow cats=32 width=3
real 0m13.767s
user 0m13.611s
sys 0m0.098s

Why is the second case so slow? Is it a bug in PNG driver? What can I
do, so it is rendered faster?

My guess is the width=3.

The "thick line" code in the PNG driver is a truly awful hack (see
store_xy() in lib/pngdriver/Draw_line.c).

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote:

> export GRASS_PNGFILE=/tmp/pokus.png
> export GRASS_RENDER_IMMEDIATE=TRUE
>
> time d.vect map=soils@PERMANENT
> real 0m0.197s
> user 0m0.166s
> sys 0m0.019s
>
> time d.vect map=soils@PERMANENT color=yellow fcolor=yellow cats=32 width=3
> real 0m13.767s
> user 0m13.611s
> sys 0m0.098s
>
>
> Why is the second case so slow? Is it a bug in PNG driver? What can I
> do, so it is rendered faster?

My guess is the width=3.

The "thick line" code in the PNG driver is a truly awful hack (see
store_xy() in lib/pngdriver/Draw_line.c).

I've replaced this with a more reasonable implementation.

However, note that the PNG driver doesn't have a proper polyline
implementation; it just draws each segment as a separate line. This is
fine for single-pixel lines, but for thicker lines the lack of proper
joins may be noticeable.

--
Glynn Clements <glynn@gclements.plus.com>

Thanks, Glynn, I just used it in new GUI function - you select objects
in attribute table and they are displayed with d.vect col=yellow
width=3 in map display..

It works great, thanks again!

jachym

2007/4/6, Glynn Clements <glynn@gclements.plus.com>:

Glynn Clements wrote:

> > export GRASS_PNGFILE=/tmp/pokus.png
> > export GRASS_RENDER_IMMEDIATE=TRUE
> >
> > time d.vect map=soils@PERMANENT
> > real 0m0.197s
> > user 0m0.166s
> > sys 0m0.019s
> >
> > time d.vect map=soils@PERMANENT color=yellow fcolor=yellow cats=32 width=3
> > real 0m13.767s
> > user 0m13.611s
> > sys 0m0.098s
> >
> > Why is the second case so slow? Is it a bug in PNG driver? What can I
> > do, so it is rendered faster?
>
> My guess is the width=3.
>
> The "thick line" code in the PNG driver is a truly awful hack (see
> store_xy() in lib/pngdriver/Draw_line.c).

I've replaced this with a more reasonable implementation.

However, note that the PNG driver doesn't have a proper polyline
implementation; it just draws each segment as a separate line. This is
fine for single-pixel lines, but for thicker lines the lack of proper
joins may be noticeable.

--
Glynn Clements <glynn@gclements.plus.com>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub