[fpc-devel] sdlgraph, pre-alpha

Evgeniy Ivanov lolkaantimat at gmail.com
Wed Aug 22 18:24:29 CEST 2007


2007/8/22, Jonas Maebe <jonas.maebe at elis.ugent.be>:
>
>
> It is because you do not redirect the line drawing directly to SDL,
> but instead use the default line drawing routines. Those are indeed
> very slow, because they call a procedural variable (directputpixel)
> for each pixel which has to be drawn). And directputpixel then calls
> through to SDL, which every time must recalculate the pixel position
> on the screen (instead of just adding 1 to the horizontal or vertical
> coordinate in case of horizontal/vertical line drawing).


 Hm... I really forgot to hook Line (but wrote the routine). But HLine and
VLine are hooked and the speed problem is in the Bar function, it has such
code:
           for y:=y1 to y2 do
              Hline(x1,x2,y);
HLine is hooked and works quickly. But it locks the screen every time it is
executed (but calls DirectPutPixel without locking (that's why it is fast):
procedure sdlgraph_HLine(x,x2,y: smallint);
var
temp:DefPixelProc;
begin
 temp:=DirectPutPixel;
 DirectPutPixel:=@nonBuf_DirectPutPixel;   // It doesn't lock the screen as
sdlgraph_DirectPutPixel. It's quick.
 Slock;
 HLineDefault(x,x2,y);
 Sulock;
 DirectPutPixel:=temp;
end;

If to do the same (using nonBuf_HLine) with Bar3D it would be very fast.





-- 
E.I.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20070822/95db8d0e/attachment.html>


More information about the fpc-devel mailing list