waste of RAM/bug in render.c?

Wolfgang Spraul <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.core
Organization Q AG
Message-ID <[email protected]>
Bob -

I noticed something strange when rendering a simple line from, let's say 20,20 
to 600,450.
In render.c:DrawImage(), lines 2731 to 2747 (line numbers from CVS HEAD), we 
calculate alpha, beta, radius, then length, and then check if (i >= (long) 
number_points-length)) to reallocate primitive_info to (number_points + 
length) * sizeof(PrimitiveInfo).
In the above line example, length will be 6024. number_points (2047) - length 
will thus be negative and < i (i=2). primitive_info was already 57 KB long 
(default is 2047 * sizeof(PrimitiveInfo)), and is now supposed to be 
reallocated to 225 KB! And in the end only two entries (56 bytes) will 
actually have been used to draw the line, the other 224.95 KB were wasted.
For now, I commented out the complete realloc block from 2731 to 2747.

In which cases is this reallocation actually needed?
What is the meaning of the value in the length variable (in lines 2731 to 
2747)?
Is the if statement (i >= (long) number_points - length) correct?

Regards,
Wolfgang



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.